select count(1), yourcountRow from table where yourcountRow in('conditiaon1','conditiaon2','conditiaon3') group by yourcountRow
效果是一样吧
如果是oracle 可以用decode()
select sum(case 字段名 when 第一种情况 then 1 else 0 end) as 第一种情况总数,
sum(case 字段名 when 第二种情况 then 1 else 0 end) as 第二种情况总数,
sum(case 字段名 when 第三种情况 then 1 else 0 end) as 第三种情况总数,
count(*) as 字段的总数
from 表名
group by 按照什么来统计
这是SQL或ORACLE的写法,其他的如MYSQL可能CASE方法不同