title: SQL - Creating A Conditional Where Clause For This Simple Query
body: <p>I've been trying to create a conditional where clause for my query below but I keep seeing so many alternatives I'm not sure what to use in this case.</p>
  
  <p>What I need is something along the lines of this: (though of course this code is wrong)</p>
  
  <pre><code>where casCaseType='m'
    and casCurrentWorkflowID=990
    and cmsDateCreated between @FromDate and @ToDate
  
   CASE @WFStatus
        WHEN @WFStatus=1 then eveworkflowID&lt;100
        WHEN @WFStatus=2 then eveworkflowID&lt;200
        WHEN @WFStatus=3 then eveworkflowID&lt;300
        WHEN @WFStatus=4 then eveworkflowID&lt;400
   ELSE 0
   END
  </code></pre>
  
  <p>So when I choose the WFStatus parameter as 1, it would automatically engage that section of the where clause bringing out only those results with a eveworkflowID which is less than 100.</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thanks</p>