Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Case When Return Multiple Output
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

99 Posts

Posted - 01/14/2013 :  23:11:35  Show Profile  Reply with Quote
I have my sql as below:

When Product_ID = 'A' Then 'Active'
When Product_ID = 'B' Then 'Obselete'
End As Description
When Product_ID = 'A' Then 'Good'
When Product_ID = 'B' Then 'Bad'
End As Condition
FROM Table_A

Since the two Case condition is the same, is there possible to make it into one?

Eg. Case When Product_ID = 'A' THEN 'Active' As Description, 'Good' As Condition

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/15/2013 :  00:07:39  Show Profile  Reply with Quote
Nope. CASE is not a control flow statement but its just a conditional expression.
if you really need to do it you need this

SELECT 'Active' AS Description,'Good' AS Condition
FROM Table_A
WHERE Product_ID = 'A'
SELECT 'Obselete','Bad'
FROM Table_A
WHERE Product_ID = 'B'

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000