复杂SQL

0

分组组内统计

select
	name,
	count(*),
 	count(score = 60 or null),
 	count(score = 90 or null),
 	count(score = 100 or null)
from
	t_user 
group by
	name;

注意:这里or null必须填写

分区函数

partition by

条件

(case when ... then ... when ... then ... end)