select a.name,a.score from student a left join student b on a.course = b.course and a.score < b.score
group by a.name,a.course having count(*) < 3
MySQL查詢各科成績前三名的記錄與排名的思路分析(不考慮并列)表結構如下圖 排名方法如下 首先將分數(shù)表score自連接按照第一個條件 s1.course_id = s2.course_id把s1表的課程id和s2表的課程id對應起來,但...