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
Remove toolkit infection where browser is hijcked to r9237242.cn
QueryTable.Connection error
How to popup a waraning dialog box in asp.net?
Exchange 2007/Outlook 2007 Public Folders - Non-local users cannot be given rights on this server?
Automatic delete of files in delete folder, on exit, in Outlook no longer works?
How do I remove windows Encryption
Jump from main form into sun forms code in lost focus
How do I add users to SharePoint 2.0 site via Address Book in Office 2007?
Find Pivot Table's Name
Authentication for OWA in Exchange 2007 fails.