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 |
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-03-16 : 10:47:57
|
| Hi i have another question :).Following data :ID / TYPE1 / Product2 / Product3 / Suite4 / SuiteNow i want if the type is 'product', the ID goes toa new collumn called Product, and if the type is 'Suite', i wantthe ID to go to a new Collumn called Suite.So is it possible to get these collums through a CASE Function, because i already had my data split up in 2 collums, but that was with a Join function, I just copied my tables 2 times and gave them new names. But when I try to link other tables to this table, i got Double data. So thats why i need it to be separated into a CASE function.Hope this question is not too chaoticTy |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-16 : 11:00:15
|
SELECT ID, [Type], CASE WHEN [Type] = 'Product' THEN ID ELSE NULL END AS Product,CASE WHEN [Type] = 'Suite' THEN ID ELSE NULL END AS SuiteFROM Table1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|