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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select table twice in join 1

Status
Not open for further replies.

mbowles

Programmer
Aug 27, 2001
41
US
I have 2 tables, and table1 has 2 fields that point to records in table2, one to many. I need to do a query to get one record back but populated with the data from 2 records in table2 and the single record in table1. Any thoughts?
 
Something like this?

Code:
SELECT cols
FROM table1 t1
  JOIN table2 t2 ON t1.fk1 = t2.pk
  JOIN table2 t3 ON t1.fk2 = t3.pk

--James
 
Thanks...brain freeze kept me from use the same table twice with a different dot notation!! Worked like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top