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.
Author |
Topic |
KlausEngel
Yak Posting Veteran
85 Posts |
Posted - 2010-10-03 : 14:28:12
|
How can I join 2 tables on the values in two columns?Table 1 has 4 columns and Table 2 has 3 columnsI'd like to join them on a match in columns T1Col1 / T1Col3 equals T2Col1 / T2Col2Any help is appreciated. |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-10-03 : 15:40:37
|
SELECT * FROM Table1 T1INNER JOIN Table2 T2ON T1.Col1=T2.Col1 AND T1.Col3=T2.Col2 |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-10-05 : 07:00:27
|
Also make sure to use table alias for the columns you selectMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|