title: Conditional where clause SQL Server 2012
body: <p>I've searched around, but haven't found the similar situation to what I'm trying to achieve. I want to execute the where clause expression only when the condition is true, otherwise I want to ignore the data that doesn't match it.</p>
  
  <pre><code>Where (
          case when LeaveDateTime &gt; FromDate and EnteringDateTime &lt; ToDate then
          (dateadd(d, Threshhold, LeaveDateTime) &gt;= EnteringDateTime
          end
  );
  </code></pre>
  
  <p>I get Incorrect syntax near '>='
  Can someone please help me solve this?</p>