I am using the query shown here to sum of financial target first statement(expd) is working fine it's showing sum where socode is not equal to 29 and 42. But the
second statement I want to get sum only where socode = 42 and 29 and 20 but its giving 0.00 value while 29 and 42 having its own value.
select
isnull(CONVERT(DECIMAL(10, 2),
SUM(CASE WHEN SoCode <> 42 and SoCode <> 29 and SoCode <> 20
THEN (Financialtarget)/100000 ELSE 0 END)), 0) as expd,
isnull(CONVERT(DECIMAL(10, 2),
SUM(CASE WHEN (SoCode = 29) and (SoCode = 42)
THEN (Financialtarget)/100000 ELSE 0 END)), 0) as expd1
from
MPR
where
month <= 7
and mpryear = '2014-15'
and Division = '12'
Thanks