一、问题
二、解决方案
准备数据
查询
select * from t_student t where (select count(1)+1 from t_student where class_id=t.class_id and score>t.score) <= 3
- 详解
- 总结
- 利用子查询记录结果,判断是否满足条件
一、问题
二、解决方案
准备数据
查询
select
*
from t_student t
where
(select count(1)+1 from t_student where class_id=t.class_id and score>t.score)
<= 3