I'm running the following query and getting the Operand data type varchar is invalid for sum operator error. The accountnature field is a varchar field, but I'm casting it as INT and I'm still getting the error.
'Qualified' =sum(case when (cast(AccountNature AS Int)) in ('a','b') then '1' end)
group by accountnature
SELECT 'Qualified' = sum(case when AccountNature in ('a','b') then 1 ELSE 0 end) from agreement group by accountnature