利用sql的row_number() over()函数
select * from (
select ROW_NUMBER() OVER(partition by CourseName ORDER BY Score desc) AS rownum,* from MyTest
) as a
where rownum < 4
order by CourseName
分析:over(partition by
CourseName order by
Score desc)
按照sroce
排序进行累计,partition by
是按照CourseName 分区。
分类统计:case when..then..else..end
https://blog.youkuaiyun.com/gc1329689056/article/details/91878723