mysql 一个表内根据字段对应值不同查询统计总数

时间:2017-10-26 16:05:53   收藏:0   阅读:476

SELECT  count(*),  

sum(case when identify_type=01 then 1 else 0 end ),  

sum(case when identify_type=02 then 1 else 0 end ),

 sum(case when identify_type=03 then 1 else 0 end )   FROM `user_info`;  

技术分享

原文:http://www.cnblogs.com/jiafeimao-dabai/p/7737259.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!