sql - Case...When...In a WHERE CLAUSE -


My code, as I thought it will work, is as follows:

  WHERE Cp .OwnerId = 1 more case when [CustAccountNote] & lt; & Gt; 'N / A' and [Crystallolocyth]]  

Essentially what I want to do is what omit if [CustAccountNote] and [CustRulesDocPath] both' n / a ' T-SQL does not like what I'm doing. (Shocking man).

How do I write this WHERE statement, so that two 'n / a' out of the results of those areas will not run "cp.Name = ....."?

something like that?

  WHERE cp.OwnerId = 1 AND (([CustAccountNote] = 'n / a' and [CustRulesDocPath] = 'n / a') or (cp.NAME = 'IQRRules links' Cp.NAME = 'AccountNote')) and pp.lastupdated between '01 / 01/2013 'and if the  both  and  CustAccountNote  and  CustRulesDocPath  , Then / n>  

A ', it does not matter if the value is cp.name

or , If any of CustAccountNote and CustRulesDocPath are not equal to 'n / a', then cp.name Should either be 'IQRRules links' or 'account note'.


Comments