Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select Union Syntax
Message
From
24/08/2005 11:59:08
 
 
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:
01043432
Views:
7
>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

WANT YOU DISTINCT ?
SELECT DISTINCT;
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);
       OR ;
        qmf_temp.fstop_____ = stptrn.fstop_id__ ;
        and inlist(qmf_temp.triptype__,2,4) ;
        ) ;
order by studnt_id_, stp_desc__, triptype__, program___ ;
into cursor qmf_all
Previous
Reply
Map
View

Click here to load this message in the networking platform