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
Excel Cell Click Capture
Unique index dependent on a column
How do I add a ComboBox to a C# Datagridview only in a particular cell? Not the whole column.
[http error 400 - request is badly formed] appears randomly in .net application
"An unexpected error has occurred."
How to type a character string using a shortcut key in VBA.
WSUS Connection Error
Requery needed when adding records, but not when Editing - causes problem with Continuous form used to select records
Exchange Server 2003 SMTP Problems
Access database file size increase constantly...