title: SQL Server - using CASE in WHERE clause
body: <p>I want to use <code>CASE</code> in <code>WHERE</code> clause, but it returns error. </p>
  
  <p>Can I use CASE in where clause? or how to fix it ? Thanks</p>
  
  <pre><code>SELECT * FROM hris_leave.dbo.tbl_act 
  inner join hris_leave.dbo.tstaff on hris_leave.dbo.tstaff.s_id =        hris_leave.dbo.tbl_act.s_id 
  where 
   case when acting_to is not null 
  then 
  datediff(day, acting_from, acting_to) &gt;= 90 and acting_to &gt;= '2010-10-01' 
  else
  acting_to is null
  order by  hris_leave.dbo.tbl_act.s_id 
  </code></pre>