美文网首页
Leetcode 1412. 查找成绩处于中游的学生

Leetcode 1412. 查找成绩处于中游的学生

作者: 七齐起器 | 来源:发表于2021-12-24 09:55 被阅读0次

https://leetcode-cn.com/problems/find-the-quiet-students-in-all-exams/

select a.student_id,b.student_name from (
select a.student_id
,case when count(a.score)=sum(case when a.score>b.s1 and a.score<b.s2 then 1 else 0 end) then 1 else 0 end tag 
from Exam a left join (
select exam_id,min(score)s1,max(score)s2 
from Exam
group by exam_id
)b on a.exam_id=b.exam_id
group by a.student_id
)a left join Student b on a.student_id=b.student_id
where a.tag=1
order by a.student_id
1412.png

相关文章

网友评论

      本文标题:Leetcode 1412. 查找成绩处于中游的学生

      本文链接:https://www.haomeiwen.com/subject/hzhhqrtx.html