1. 查找前几名
--25、查询各科成绩前三名的记录:(不考虑成绩并列情况) --不考虑重复
SELECT courseid,score,row_number() OVER
(PARTITION BY courseid ORDER BY score DESC) AS rn FROM tblScore
--考虑重复
SELECT courseid,score,dense_rank() OVER
(PARTITION BY courseid ORDER BY score DESC) AS rn FROM tblScore
时间: 2024-10-10 16:42:49