サブクエリなしで正常に機能するwhere句内にケース条件を記述しましたが、サブクエリでは機能しません
例えば
declare @isadmin varchar(5) = 'M'
select * from Aging_calc_all a where a.AccountNumber in
(case @isadmin when 'M' then 1 else 0 end)
これは正常に機能しています。
しかし、これはうまくいかないようです -
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)
任意の提案またはこれは 2008 年の t-sql バグです。