题解 | 每类试卷得分前3名
每类试卷得分前3名
https://www.nowcoder.com/practice/255aa1863fe14aa88694c09ebbc1dbca
WITH t AS ( SELECT uid, tag, max( score ) AS da, min( score ) AS xiao FROM exam_record left join examination_info using(exam_id)where score is not null GROUP BY 1, 2 order by 2,3 desc ) select * from( SELECT tag, uid, row_number() over ( PARTITION BY tag ORDER BY da DESC, xiao DESC, uid DESC ) AS ranking FROM t ) tmp where ranking<=3
查看16道真题和解析