Microsoft
Software
Hardware
Network
Question : TSQL CASE and the WHERE CLAUSE
Hi There,
I'm having difficulty trying to get my case statement in the where clause. This is what I am trying to do ..
Select bla bla
FROM bla bla
WHERE
case
when @Letter = 'TEST' then jn.PRINTED = 0 and jn.cust = 'ABC'
when @Letter = 'TEST1' then jn.PRINTED = 0 and jn.cust = 'XYZ'
else jn.PRINTED = 0 and jn.cust = 'XXX'
end
But I am getting a syntax error, can someone help with where I'm going wrong please?
TIA, Roger
Answer : TSQL CASE and the WHERE CLAUSE
Select blabla
FROM bla
WHERE
( @Letter = 'TEST' AND jn.PRINTED = 0 and jn.cust = 'ABC' )
OR
( @Letter = 'TEST1' AND jn.PRINTED = 0 and jn.cust = 'XYZ' )
OR (jn.PRINTED = 0 and jn.cust = 'XXX' )
Random Solutions
How to read field names from an XSD file.
blue Screen on windows 2003 sp1
What are the recommended alternatives to the Office Web Components when used in Microsoft Access
Open Word document, fill bookmarks, then Insert a Word File into active document
How do I change default accept meeting response to "Do not send response"?
vb.net - get ip address from host
BESR VHD Error
Advice needed for internet-only machine
How do I hide the splash screen on application load? VB.NET 2005
IIS Anonymous User Password