Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Translating a relation between three tables to a Query in SQL

Status
Not open for further replies.

Xaplytz

Programmer
Jun 26, 2000
79
US
I have a relation between three tables
A transaction table, Customer Table and Inventory Table.
I have to make a SQL Query With SQLEXEC() to get a cursor that has the transactions , the name of the Customer and the description of the Items.

Table-A Transactions
Table- B Master of Customer
Table- C Master of Items

Between them are two common field TA.x with TB.x and TA.y with TC.y.
When I try to make a Query with a SELECT command
I just can pull the data from two tables when I try to use
The third table I get Nothing .

I know this question is more related to SQL than VFP
but may be some VFP programmer had the same problem.

I will appreciate any help
Thank.
[sig][/sig]
 
Can you post a query you made? It is much more easy to discuss query than try to understand what you want from words.
I will try to write query you want, but I'm not sure it is what you want:

SELECT ta.*, tb.*, tc.*
from Transactions ta
inner join customer tb
on ta.x = tb.x
inner join Items tc
on ta.y = tc.y

If transaction table contain coorect link records between customers and items, above query should not return empty result.
[sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top