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)
 Multiple join Query

Author  Topic 

atiqraza
Starting Member

11 Posts

Posted - 2007-01-26 : 11:21:38
Could anyone tell me what i am doing wrong here,
I want to do join three tables together,
I have one master table and i am performing a left outer join on it with two tables.

select * from custmast a left outer join chainmlrc b, chainbanner c on
a.country = b.country and
a.can_prim_chain_code = b.[chain ID] and
a.can_prim_chain_code = c.[chain ID] and
a.can_prim_region_code =c.[banner ID]

Is this possible or do i have to create a view for the first join and then join it with the second table.

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-01-26 : 13:07:58
You need to specify each join separately like this

select * 
from custmast a
left outer join chainmlrc b on a.country = b.country and
a.can_prim_chain_code = b.[chain ID]
left outer join chainbanner c on a.can_prim_chain_code = c.[chain ID] and
a.can_prim_region_code =c.[banner ID]
Go to Top of Page
   

- Advertisement -