统计的sql 语句,同一个字段为不同值进行统计

版权声明: https://blog.csdn.net/qq_32157851/article/details/83754489

select     sum(case status when 'high' then 1 else 0 end) intHigh ,sum(case status when 'middle' then 1 else 0 end) intMiddle,sum(case status when 'low' then 1 else 0 end) intLow      from tbl_tableName;

猜你喜欢

转载自blog.csdn.net/qq_32157851/article/details/83754489