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
ISA Server and Cisco equipment -- will it work/help?
Problem with subreport printing?
Cannot Print Individual Page From Word Document
Passing data between two Windows Apps - ActiveX or DDE?
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
Access hangs Windows Scheduled Task unless logged on on Windows Server
Active Directory removing default permissions on user objects
Denied GPO
Outlook 2007 search
Need to know how to set a cell to blank when the value is an integer like relace 0 and 0.00 with a blank