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 2005 Forums
 Other SQL Server Topics (2005)
 Can join 3 or more than tbls by using joinconditn?

Author  Topic 

kavi12345
Starting Member

19 Posts

Posted - 2012-03-07 : 01:56:15
Hi,can we join 3 or more than tables by using Join condition?? for example if we wanna join 2 tables,we can use like this(tbl1 inner join tbl2).Perhaps while joining 3 or more than tables what we should we do?which is best path?..Thanks in advanc...

kavichakravarthi.R

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-03-07 : 02:12:28
Yes it is possible to join more than 2 tables.
The ON clause is the answer to the question on how to do that and the web is full of examples.
SQL Server engine will find the best path.



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

kavi12345
Starting Member

19 Posts

Posted - 2012-03-07 : 02:18:03
@webfred,.ok fine..if i want to join tbl3 along with this query(tbl1 inner join tbl2).what should i write?.can i write ,tbl1 inner join tbl2,tbl3.is it possible?

kavichakravarthi.R
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-03-07 : 03:07:30
for example:
select *
from tbl1 as t1
inner join tbl2 as t2 on t2.id = t1.id
inner join tbl3 as t3 on t3.id = t1.id


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

kavi12345
Starting Member

19 Posts

Posted - 2012-03-07 : 04:34:29
Thanks dear..i'll hav to learn more and more..

kavichakravarthi.R
Go to Top of Page
   

- Advertisement -