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
SSIS Security
Excel: move 'value "+wildcard" to other column
Deploying Windows 7 with no mini-setup?
Grid: display one record in different rows
Is is possible to take of and land a cessna 172 or 152? on an aircraft carrier
Need example code to programmatically pin a folder to make it "Always Available Offline"
C# SQL Query considerations against a large database
i want to "get into" my laptop, secured with a password, that i do not remember
How to export cmd.exe output to a .txt file when using the command nslookup
Excel: how can i obtain the cross product of concatenating two columns