Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Inner Joins

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-04 : 08:12:45
Stuart writes "I have three related tables. I understand how to construct an Inner Join along the lines of

table1 inner join table2 on table1 inner join table3 on table2 ......

But how do you construct

table1 inner join table2 on table1 inner join table3 on table1 ......

i.e the relationship is 1 to 2, 1 to 3 NOT 1 to 2, 2 to 3

hope this makes sense"

Nazim
A custom title

1408 Posts

Posted - 2002-06-04 : 08:34:25
table1 t1 inner join table2 t2
on t1.pkey=t2.pkey
inner join table3 t3
on t1.pkey=t3.pkey




--------------------------------------------------------------
Go to Top of Page

davy_boy2000
Starting Member

28 Posts

Posted - 2002-06-04 : 08:36:15
SELECT TAB1.TAB1_id
FROM TAB1 INNER JOIN (TAB2 INNER JOIN TAB1 ON TAB2.TAB2_id = TAB1.TAB1_TAB2) ON TAB3.TAB3_id = TAB1.TAB1_TAB3

Is this what you mean?

Go to Top of Page
   

- Advertisement -