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
 General SQL Server Forums
 New to SQL Server Programming
 Multi-table queries for M:N situations

Author  Topic 

Chopsmum
Starting Member

38 Posts

Posted - 2006-05-29 : 07:55:10
Hi friends,

when I write multi-table queries which involve two tables which are joined via a bridging table (M:N),

do I just join the tables or do I have to reference the bridging table as well in the queries?

Cm

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-29 : 07:59:03
you will need to use INNER JOIN to join both tables and the bridging table.
example :
select *
from table1 t1 inner jion table2 t2
on t1.col1 = t2.cola
inner join table3 t3
on t2.colb = t3.col1



KH

Go to Top of Page

Chopsmum
Starting Member

38 Posts

Posted - 2006-05-29 : 08:02:25
thank you very much

like audio visual RCA too!!!

ha ha ha
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-29 : 08:54:50
Also Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -