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)
 Inner Join on more than one criteria

Author  Topic 

MyronCope
Starting Member

46 Posts

Posted - 2007-05-01 : 10:51:38
Hi,

I want to do an inner join on more than one criteria, p_code and s_code, what is the syntax for this?

IE:
<CODE>
INNER JOIN TableA ON TableA.p_code = TableB.p_code,
TableA.s_code = TableB.s_code
</CODE>

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-01 : 10:59:52
AND not ,


INNER JOIN TableA
ON TableA.p_code = TableB.p_code
AND TableA.s_code = TableB.s_code



KH

Go to Top of Page

coolerbob
Aged Yak Warrior

841 Posts

Posted - 2007-05-01 : 11:15:03
So many people don't know they can do this. And their SQL remains primitive as a result
Go to Top of Page
   

- Advertisement -