标签:
select CustomerId
,Amount = SUM(Amount)
,InterestAmount = SUM(case when OpType = 1 then Amount else 0 end)
,PrincipalAmount = SUM( case when OpType = 2 then Amount else 0 end)
,TotalCount = Count(0)
from
标签:
原文地址:http://www.cnblogs.com/feifeikui/p/4661669.html