Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select Union Syntax
Message
De
24/08/2005 11:59:08
 
 
À
24/08/2005 11:45:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Divers
Thread ID:
01043414
Message ID:
01043432
Vues:
6
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform