Microsoft
Software
Hardware
Network
Question : Put Two Case conditions in same select statement - SQL Server 2005
Hello Experts,
I have a stored procedure with a select statement which contains a CASE condition like this:
SELECT A, B, C, "D" = CASE
WHEN Condition
Then 'some value'
WHEN Condition
Then 'another value'
--etc
From Table1
Question - Is it possible to add another CASE condition like this:
SELECT A, B, C, "D" = CASE
WHEN Condition
Then 'some value'
WHEN Condition
Then 'another value'
--etc
, "E" = CASE
WHEN Condition
Then 'some value'
WHEN Condition
Then 'another value'
--etc
From Table1
I tried this but I get a syntax error near the ,
Does anyone know how to do this??
Thanks!
From Table1
Answer : Put Two Case conditions in same select statement - SQL Server 2005
SELECT A, B, C, "D" = CASE
WHEN Condition
Then 'some value'
WHEN Condition
Then 'another value'
END,
E =
CASE
WHEN Condition
Then 'some value'
WHEN Condition
Then 'another value'
END
From Table1
Random Solutions
OCS Federated Contacts DO NOT show presence?
Cannot joining a Windows server 2008 domain from xp computer
adding routes between two netkorks
XP Safe Mode Boot Hangs on hpdskflt.sys
SendObject email modal
how to open, review, and edit a .exe file?
How to Set Default Domain Controller? SBS 2003 / Exchange 2007
Freeware Registry Editor for WIndows Mobile 6.1?
Code to open a .csv file, edit and save
need to Trim and cast a string as a number