Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

CASE STATEMENT IN WHERE CLAUSE

$
0
0

IN MY WHERE CLAUSE, I NEED TO DETERMINE THE FOLLOWING:

(((WHERE
  gl.CashierDate >= @BeginDate AND
  gl.CashierDate < DateAdd(d, 1, @EndDate) AND
 
  IF THE ACCOUNTNUMBER IS '22030000' THEN I NEED TO EXCLUDE THESE TWO  DISBURSEMENTCODE ('670','670A')
  IF THE ACCOUNTNUMBER IS '20350000' THEN I NEED TO EXCLUDE THESE FOUR DISBURSEMENTCODE ('215','215B','305','305A')

  IF THE ACCOUNTNUMBER IS ANYTHING BUT THESE TWO ACCOUNTS, THEN I DONT NEED TO EXCLUDE ANYTHING

Thank you for your help!

 

 

  I WANT TO USE CASE STATEMENT FOR THIS BUT NOT CERTAIN HOW TO DO IT.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>