Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help finishing SQL
Message
From
30/11/1998 14:06:12
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00162437
Message ID:
00162479
Views:
30
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform