title: Add case statement in where Clause with Date Between
body: <p>I'm trying to add cases in where clause with Date between, but getting  syntax error.</p>
  
  <p>i had showing syntax error in <em>AND</em>, <em>hh</em> etc on below code</p>
  
  <pre><code>select * from my_under mu
      where mu.modified_date between
          CASE 
              WHEN @lastRunTime IS NOT NULL 
                  THEN @lastRunTime *AND*  DATEADD(hh,-@timeInterval,DATEADD(Mi,1,@lastRunTime))
              *ELSE* 
                  DATEADD(*hh*,-@timeInterval,DATEADD(*Mi*,1,GETDATE())) AND DATEADD(*hh*,-@timeInterval,GETDATE()) 
          END
  </code></pre>
  
  <p>Please let me know whats wrong in syntax</p>