Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper Join Syntax
Message
De
05/02/1999 11:45:26
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00184398
Message ID:
00184415
Vues:
27
Hi Stephen --- the granularity of your result sets dictates the primary table in the join. Sounds to me like your primary table is sotrans and that the join would be (with some revisions in data selected, I'm sure):


SELECT *, SUM(sotrans.numunits) AS sumunits, SUM(sotrans.amount) AS sumamt ;
FROM sotrans,soheader,custaddr WHERE ;
sotrans.sono=soheader.sono AND ;
custaddr.custno=soheader.custno ;
ORDER BY custaddr.shipto ;
GROUP BY custaddr.shipto

>How does VFP optimize a query when using join clauses?
>
>I have to get data from 2 children tables. The link is via the parent.
>
>Parent : SoHeader has customer ship to # and SoNo and CustNo
>Child1 : SoTrans has what was ordered, and SoNo
>Child2 : CustAddr has Customer ship to address.
>
>I need to get $s and # of units totals from SOTrans, and group them by each ship to location.
>
>So do you start at the parent, or a child in the SQL when using joins?
>
>TIA
>
>__Stephen Russell
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform