Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Joining multiple tables.
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00257176
Message ID:
00257215
Views:
21
Ken, I left out one AND line of the SELECT. The WHERE should be:

WHERE SoDetail2.ItemNo = SoDetail1.ItemNo ;
AND SoDetail2.SoNumber = SoDetail1.SoNumber ;
AND SoDetail1.SoNumber = SoMaster.SoNumber

Sorry (sheepish grin)

Evan Pauley

>Hi Ken,
>
>Without knowing the fields you want, or the names of the detail tables, here's my best guess at what you're looking for:
>
>-- code snip follows --
>
>SELECT ALL ;
> SoMaster.Field1, ;
> SoMaster.Field2, ;
> SoDetail1.Field1, ;
> SoDetail1.Field2, ;
> SoDetail2.Field1, ;
> SoDetail2.Field2, ;
> ;
>FROM SoDetail2, SODetail1, SoMaster ;
>WHERE SoDetail2.ItemNo = SoDetail1.ItemNo ;
>AND SoDetail1.SoNumber = SoMaster.SoNumber
>
>-- end code snip --
>
>You don't need to link the two detail tables together, since you're already linking the master to the first detail table and there's a common link between the two detail tables.
>
>Evan Pauley
>
>
>Ken Morehouse wrote:
>>Hello all,
>>This is probably a question that has been asked numerous times, but I have an urgency.
>>
>>Scenario:
>>1 Sales Order Master Table and 2 detail tables
>>I need to select all SO's for a given customer from the master.(This is no problem). Next I need to select the item detail from 2 separate tables. the 2 detail tables need to link to the master by SOnumber, and to each other by SOnumber and ItemNumber.
>>
>>Any ideas? I'm racking my brain on this one. I have fallen on the wayside from coding anymore, but need to get this project out for the sales dept ASAP. ANY HELP WILL BE GREATLY APPRECIATED!!
>>
>>Thanks in advance,
>>Ken Morehouse, MCP
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Reply
Map
View

Click here to load this message in the networking platform