Leetcode 1112. 每位学生的最高成绩

https://leetcode-cn.com/problems/highest-grade-for-each-student/

select 
a.student_id
,a.course_id
,a.grade 
from
(
    select 
    student_id
    ,course_id
    ,grade
    ,row_number() over(partition by student_id order by grade desc,course_id )rn
    from Enrollments
)a where a.rn=1

你可能感兴趣的:(Leetcode 1112. 每位学生的最高成绩)