select
sum(case when status=1 and pay=1 then 1 else 0 end) pay_count
from
user;
统计,如果 status 和 pay 都等于 1 统计加 1 不然加 0!pay_count 是别名。
select
sum(case when status=1 and pay=1 then 1 else 0 end) pay_count
from
user;
统计,如果 status 和 pay 都等于 1 统计加 1 不然加 0!pay_count 是别名。
转载于:https://my.oschina.net/banbo/blog/464608