日期:2014-05-17 浏览次数:20792 次
select OfficeID, sum(case when Isgroup=0 and Paytype=0 then salenum else 0 end) XGSaleNum, sum(case when Isgroup=0 and Paytype=0 then salemoney else 0 end) XGSaleMoney, sum(case when Isgroup=1 and Paytype=0 then salenum else 0 end) 现金团体总数, sum(case when Isgroup=1 and Paytype=0 then salemoney else 0 end) 现金团体金额, sum(case when Isgroup=0 and Paytype=1 then salenum else 0 end) 支票个人总数, sum(case when Isgroup=0 and Paytype=1 then salemoney else 0 end) 支票个人总金额, sum(case when Isgroup=1 and Paytype=1 then salenum else 0 end) 支票团体总数, sum(case when Isgroup=1 and Paytype=1 then salemoney else 0 end) 支票团体金额 from t_saleloginfo group by OfficeID