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 |
|
dazw1
Starting Member
2 Posts |
Posted - 2008-10-09 : 07:17:10
|
| Hi,I have a table which has a column called 'Type', the values that are in the column are either 'Type1' or 'Type2'what I want is a select statement which JOINS on a different table depending on the value that is in the column 'Type'. soooo something like:WHERE Type = 'Type1' LEFT JOIN thistableWHERE Type = 'Type2' LEFT JOIN thistableany help would be great |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-10-09 : 07:45:20
|
SELECT *FROM MasterTable AS mtLEFT JOIN ThisTable AS t1 ON t1.Col1 = mt.Col1 AND mt.Type = '1'LEFT JOIN ThatTable AS t2 ON t2.Col1 = mt.Col1 AND mt.Type = '2' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
dazw1
Starting Member
2 Posts |
Posted - 2008-10-09 : 08:09:55
|
| awesome thanks very much |
 |
|
|
|
|
|