标签:分类 when article www 复杂 from cms change 用户
1.需要汇总同一用户的资金,还要根据这些资金的类型进行分类统计:
使用案例:
select cms.uid,sum(cms.money) 总支出,sum(case when cms.change_type=‘7‘ then cms.money else 0 end) as 激活用户,
sum(case when cms.change_type=‘5‘ then cms.money else 0 end) as 转账,
sum(case when cms.change_type<>‘5‘ and cms.change_type<>‘7‘ then cms.money else 0 end) as 其他
from cms_member_funds cms where cms.money<0 GROUP BY cms.uid
参考网站:http://www.jb51.net/article/46205.htm
标签:分类 when article www 复杂 from cms change 用户
原文地址:http://www.cnblogs.com/Aaronqcd/p/6087153.html