title: select inside case statement in where clause tsql
body: <p>I have written a case condition inside where clause which is working fine without any sub queries, but it is not working with sub queries</p>
  
  <p>for example</p>
  
  <pre><code>declare @isadmin varchar(5) = 'M'
  
  select * from Aging_calc_all a where a.AccountNumber in 
  (case @isadmin when 'M' then 1 else 0 end)
  </code></pre>
  
  <p>which is working fine.</p>
  
  <p>However this does not seem to work - </p>
  
  <pre><code>select * from Aging_calc_all a where a.AccountNumber in 
  (case @isadmin when 'M' then (select AccountNumber from ACE_AccsLevelMaster where AssignedUser=7) else 0 end)
  </code></pre>
  
  <p>Any suggestions or this is a t-sql bug in 2008.</p>