title: sql case statements to compare not equal to with list of condition
body: <p>I need to write a condition to make sure the condition is not equal to</p>
  
  <pre><code>select * from xtable x
  inner join ytable y
   on x.column1 =y.column1
  inner join ztable z
  on y.column2 =z.column2
  where x.column4 = 'abc'
  and y.column3 &lt;&gt; cast(z.column4 as bit)
  and y.column4 = 'xyz'
  </code></pre>
  
  <p>I am getting error at cast because y.column3 has only 0 or 1 values where has z.column4 has more than 0 and 1 value how can i make other values as 0 or 1 depending upon the value.</p>
  
  <p>i sepreatly wrote the select statement to print 0 and 1 depending upon the condition</p>
  
  <pre><code>select case z.column4
  when 'True' then 1
  when 'false' then 0
  when 'From: False To True' then 1
  when 'From: True to False' then 0
  end as status
  from ztable z
  </code></pre>
  
  <p>I am not able to incorproate both together, its giving out error if write like below</p>
  
  <pre><code>   select * from xtable x
     inner join ytable y
     on x.column1 =y.column1
     inner join ztable z
     on y.column2 =z.column2
     where x.column4 = 'abc'
     and y.column3  &lt;&gt;  (case when z.column4 = 'True' then 1 
     when z.column4 = 'false' then 0
     when z.column4 = 'From: False To True' then 1
     when z.column4 = 'From: True to False' then 0)
     and y.column4 = 'xyz'
  </code></pre>