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
 Join question

Author  Topic 

Inno
Starting Member

33 Posts

Posted - 2006-11-22 : 09:42:03
Can I make a join on two columns?

I have two tables with columns

Number, ArtNo, Ware

There is just one row in each table for each combination of ArtNo and ware. And I want for each combination see if Number is the same value

X002548
Not Just a Number

15586 Posts

Posted - 2006-11-22 : 09:50:56
You sure about that? DDL and sample data would help...read the hint link in my sig...BUT

SELECT l.ArtNo, l.Ware, l.Number, r.Number
FROM table1 l join table 2 r
ON l.ArtNo = r.ArtNo AND l.Ware = r.Ware



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-22 : 11:32:20
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 -