如何获取业务表中各位业务员的业务类型A与业务类型B的业务金额
时间:2011-04-19 来源:lucky.dai
设表为:业务表字段:业务员,业务类型(A,B),业务金额
select 业务员, sum(priceA) as priceA,sum(priceB) as priceB
from
(
select
业务员
,业务类型
,(case when t_s_module.业务类型=A then sum(业务金额) else '0' end) as priceA
,(case when t_s_module.业务类型=B then sum(benable) else '0' end) as priceB
from 业务表
group by 业务员,业务类型)
as 业务类型分类金额表
group by st.student
相关阅读 更多 +