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
OUTLOOK 2003 is not working with ISA 2006
Outlook user can replay to internal email, but not send new email
REMOVING TIMESTAMP FROM A DATE FIELD
Event ID 1001 BSOD System Reboot After BugCheck Windows XP
step-by-step how to import csv file to sql table
How would I extract one of each number in an excel column that contains many copies of hundreds of numbers?
Deploy a change in registry in a terminal server farm
Ms Access to SQL Server DSN or connection string
BAR CHART in EXCEL data is upside down..
Take some of the data from cursor to a variable