设表为:业务表字段:业务员,业务类型(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

posted on 2011-04-19 11:35  lucky.dai  阅读(259)  评论(0)    收藏  举报