sqldeclarevarchar
发布时间: 2025-05-09 15:15:27
❶ sql语句统计数量,统计一个字段的值的数量
select type,count(*) as 总数量,
sum(case when level='一级' then 1 else 0 end) as 一级,
sum(case when level='二级' then 1 else 0 end) as 二级,
sum(case when level='三级' then 1 else 0 end) as 三级
from table group by type
楼上的应该改改吧
热点内容