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
HTC P3400 - Synchronization Problem with HP Laptop - Windows Vista Home Premium
How do I format text to diplay currency in VB?
increasing Checkbox index in a loop
MS Word multiple sheets
Exactly what does Compact and Repair do?
What is a 'Database consistency check'?
Escape while loop, then re-run while loop
Font in Cobo Box shrinks when I select from it
Why does EE not allow file uploads with the .accdb extension?
Copy/Paste and sum total in excel