select Account,
sum(case when Type='D' then Amount * -1 else Amount end) as AmountSum
from Payment
group by Account
RedFilter
2010-08-18 21:16:47
select Account,
sum(case when Type='D' then Amount * -1 else Amount end) as AmountSum
from Payment
group by Account