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:
01043417
Views:
8
This message has been marked as a message which has helped to the initial question of the thread.
You can not put ORDER BY clause in each select. It has to be done at the end of the command. Also you have to use numbers, not field names, e.g. ORDER BY 1,3,5

>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
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform