Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select Union Syntax
Message
 
 
To
24/08/2005 11:45:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Miscellaneous
Thread ID:
01043414
Message ID:
01043440
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
The ORDER BY clause sorts the result of the UNION so it can be used only once at the end of the query. In UNION query before VFP9 you can only specify fields by position not by name. Keep also in mind that UNION does implicit DISTINCT on the resultset. If it's undesireable, use UNION ALL.


>I am trying to combine into on table after collecting addition info, but I keep getting:
>Command contains unrecognized phase / keyword.
>sql order by invaild - when I remove the first order by line.
>
>But when I run the two select statements seperately, I get the correct info.
>
>SELECT qmf_temp.*, stops.stp_desc__ AS schl_desc FROM stops, stptrn, qmf_temp ;
>  WHERE stops.stop_id___ == stptrn.stop_id___ AND ;
>        qmf_temp.fstop____2 = stptrn.fstop_id__ ;
>        and inlist(qmf_temp.triptype__,1,3) ;
>        order by studnt_id_, qmf_temp.stp_desc__, triptype__, program___ ;
>union ;
>SELECT qmf_temp.*, stops.stp_desc__ AS schl_desc FROM stops, stptrn, qmf_temp ;
>  WHERE stops.stop_id___ == stptrn.stop_id___ AND ;
>        qmf_temp.fstop_____ = stptrn.fstop_id__ ;
>        and inlist(qmf_temp.triptype__,2,4) ;
>        order by studnt_id_, qmf_temp.stp_desc__, triptype__, program___ ;
>into cursor qmf_all
>
>
>TIA
>Beth
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform