日期:2014-05-20 浏览次数:20730 次
select ss, sum(case when 货币类型='澳门币' then 钱 else 0 end) as '澳门币', sum(case when 货币类型='香港币' then 钱 else 0 end) as '香港币', sum(case when 货币类型='其他货币' then 钱 else 0 end) as '其他货币', sum(钱) as '汇总' from 表名 group by ss union all select '汇总', sum(case when 货币类型='澳门币' then 钱 else 0 end) as '澳门币', sum(case when 货币类型='香港币' then 钱 else 0 end) as '香港币', sum(case when 货币类型='其他货币' then 钱 else 0 end) as '其他货币', sum(钱) as '汇总' from 表名