Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL SELECT making me crazy! HELP?!?!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00361642
Message ID:
00361881
Vues:
19
>Here's my SELECT command example that doesn't do what I want. What I want it to do is look at my lookup code table named AEDRPT. And grab the right code from the code table so the code gets translated into a bunch of words. For example, in my code table I have OT in aedrpt.aedloc and OTHER in aedrpt.locdesc. I also have 01 in aedrpt.trainedby and AMERICAN RED CROSS in aedrpt.tranbydesc. I think you get the picture. I have several code fields with descriptions in my lookup code table. I am trying to SELECT all records from my AED_INFO table and translate the codes in the AED_INFO table that are looked up in the lookup code table. Then I put the results in my CURSOR named rpt. Then I look at RPT in my report designer to print a report. The report was working fine until I started translating the codes. Now I don't get what I want so obviously my JOIN is wrong, but I don't know what's wrong. Please help, thanks! I tried JOIN ... AND instead of JOIN ... OR and LEFT JOIN and OUTER JOIN, but
>not what I want. Sorry about the OR that wrapped around. It's really on the line above.
>
>Here is my actual code:
>
>IF THISFORM.cborpt.Value = "23"
>        SELECT aed_info.*, aedrpt.* ;
>		FROM aed_info, aedrpt ;
>		INNER JOIN aedrpt ON aed_info.aedloc = aedrpt.aedloc OR ;
>			aed_info.hrs = aedrpt.hrs OR ;
>			aed_info.aed_cautn = aedrpt.aed_cautn OR ;
>			aed_info.trainedby = aedrpt.trainedby OR ;
>			aed_info.whowants = aedrpt.whowants OR ;
>			aed_info.emspager = aedrpt.emspager ;
>		ORDER BY aed_info.city, aed_info.unitid ;
>		INTO CURSOR rpt
>		select rpt
>		browse
>	IF THISFORM.cboOutputTo.Value = "S"
>		REPORT FORM \arrest\reports\aedlocdt.frx PREVIEW IN SCREEN
>	ELSE
>		REPORT FORM \arrest\reports\aedlocdt.frx TO PRINT
>	ENDIF
>ENDIF
>
This may not solve the entire problem with your SQL select but you want to remove aedrpt from the FROM line. Generally a join is listed as:
SELECT ... FROM table1 JOIN table2 ON table1.expression1 = table2.expression

I hope this helps.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform