Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need help finishing SQL
Message
De
30/11/1998 14:06:12
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00162437
Message ID:
00162479
Vues:
24
>I have this SQL:
>
>
>SELECT A.zdesc, A.zone, ;
>       B.cdesc, B.ctype, ;
>       NVL(B.ncnt,0) AS pccnt, ;
>       NVL(C.ncnt,0) AS dccnt, ;
>       NVL(D.ncnt,0) AS ptcnt, ;
>       NVL(D.ncnt,0) AS dtcnt ;
>   FROM allzones A, p_ccnt B, d_ccnt C, p_tcnt D, d_tcnt E  ;
>   INTO CURSOR zsum ;
>   WHERE ???
>
>
Just use LEFT JOIN to add all the others to A

something like
...
FROM allzones A ;
   LEFT JOIN p_ccnt B ;
         ON a.iID = b.iZoneID ;
   LEFT JOIN d_ccnt C ;
         ON a.iID = C.iZoneID ;
   LEFT JOIN p_tcnt D ;
         ON a.iID = D.iZoneID ;
   LEFT JOIN d_tcnt E ;
         ON a.iID = E.iZoneID ;
...
Arnon
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform