June 7, 2009 at 7:13 am
Hi All
I have a case statement which looks are 3 different columns to evaluate the expressions, the problem i am facing is tht as soon as it hits the first expression and that is true, it outputs the results and goes straight to End. This leaves out the other 2 expressions but i need the other 2 as the text needs to be Concatenated together.
I can output the other 2 as seperate columns, but i need them all to be in one single column without outputing the other 2.
June 7, 2009 at 7:59 am
you didn't give any details, so here's an example that may help you.
a case statement can evaluate more than one item:
SELECT
CASE
WHEN Column1 = 'Approved' AND Column2 > (GETDATE() -14)
THEN 'some status
WHEN Column1 = 'Approved' AND Column2 <= (GETDATE() -14) AND MANAGMENTDELAY = 1
THEN 'another status'
ELSE 'Pending'
END
FROM SOMETABLE
you could also have nested case statments so taht the THEN clause starts a whole separate CASE conditional testing. let us know if you need an example of that.
Lowell
June 7, 2009 at 8:23 am
thanks for the info, I have just sent you a PM.
cheers
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply