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
 Transact-SQL (2005)
 Multiple join Query

Author  Topic 

atiqraza
Starting Member

11 Posts

Posted - 2007-01-26 : 11:19:12
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.

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2007-01-26 : 11:23:21
The correct Syntax would be

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]


Srinika
Go to Top of Page

Benjamin78
Spammer

4 Posts

Posted - 2007-01-26 : 11:27:55
*** spam removed ***
Go to Top of Page
   

- Advertisement -