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 |
|
sqlnewbie87
Starting Member
4 Posts |
Posted - 2011-06-21 : 07:35:08
|
| hi there,here is my problem. lets assume i have a followin table:status test test2------ ----- -----1 5 252 31 5 251 5 251 5 252 1 5 251 5 25I need to do two things first derive a case and the consequent column 2 viaselect status,case statuswhen '1' then status*5else ''.END AS testselect TEST,case TESTwhen '5' then status*5else ''.END AS test2CAN U TELL ME WHO TO DERIVE A THIRD COLUMN FROM CASE AS WELLMANY THANKS,D |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-06-21 : 07:42:12
|
| select status,Test ,case Testwhen '5' then status*5else ''.END AS test2from(select status,case statuswhen '1' then status*5else ''.END AS test ,from tbl) a==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|