sql分组统计
sql分组统计
日期:2021-04-24 06:01:19 人气:1
select sno,type ,count(type)from table group by sno,type
这是竖的,横的下面
select sno,sum(case when type='a' then 1 else 0 end) as t_a,sum(case when type='b' then 1 else 0 end) as t_b,sum(case when type='c' then 1 else 0 end) as
这是竖的,横的下面
select sno,sum(case when type='a' then 1 else 0 end) as t_a,sum(case when type='b' then 1 else 0 end) as t_b,sum(case when type='c' then 1 else 0 end) as