Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Syntax Help
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00239121
Message ID:
00239199
Vues:
16
>>>>I'm often confused by whether I need to include all the fields I mention in my WHERE clauses when selecting fields for the result set, and it's just now coming to a head - perhaps someone here could clarify for me.
>>>>
>>>>Let's say for example I want a list of all the items ever purchased by a client, and those items are linked to the client number through a long tree:
>>>>
>>>>Clients ---- Invoices ---- InvDetail ---- Items
>>>>
>>>>Can I get this list by saying:
>>>>
>>>>SELECT Items.ItemName FROM Items, InvDetail, Invoices ;
>>>> WHERE Invoices.ClientNo = "12345" ;
>>>> AND InvDetail.InvoiceNo = Invoices.InvoiceNo ;
>>>> AND Items.ItemNo=InvDetail.ItemNo ;
>>>> ORDER BY 1 ;
>>>> INTO CURSOR JustItems
>>>>
>>>>... or do I need to include clientno, both invoiceno's and both itemno's in the field list?????
>>>>
>>>>TIA
>>>
>>>You can do something similar without having to include the fields by using joins instead.
>>>
>>>Dan
>>Dan;
>>
>>Thanks for replying in 3 minutes! What great service I get here on UT!
>>
>>Just to make sure I understand:
>>
>>If I stick with the WHERE's to define the relationships, I need to include the fields in the field list, but if I do JOINs instead of WHEREs I won't have to???
>
>What fields you include (before the FROM) have nothing to do with your JOIN or WHERE conditions.

I see - so VFP treats a WHERE exactly like an INNER JOIN, and I don't need to include the fields either way, eh?
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform