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`;
运行结果:
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`;
运行结果: