title: Conditions in Where Clauses based on a flag
body: <p>Can I use a flag to select different WHERE clause? Something like this.</p>
  
  <pre><code>SELECT  fields
   from T3 t3 
  left outer join T1 t1 on T1.Id=t2.Id
  WHERE 
      CASE 
          WHEN @Status &lt;&gt; 1 
          THEN (t3.Id = @SId AND sh.StatusId = 3 AND k.StatusId = 1)
          ELSE t2.Id = @SID AND  t2.StatusID = 12
  GROUP BY whatever
  </code></pre>