General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only