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
How do I uninstall Advanced Mass Sebder?
CInt not working
How To Recover Encrypted / Corrupted Word Documents
help with trigger/stored procedure
outlook vba to saveas .msg allowing user to navigate to target folder.
convert between email address to ip address
Customizing a SQL Contains statement for performance.
Using More Than 1 Delimiter In Excel 2007 (Pipe & Comma)
SBS Reinstall Monitoring MSDE after SP1 upgrade
ACCESS 2000 - Opening a Snapshot Recordset