提取表中每个分组的前几条数据 SELECT 课程, SUM(奖金) AS 奖金 FROM ( SELECT 课程, 学号, 成绩 FROM 考试 AS a WHERE ( SELECT COUNT(*) FROM 考试 WHERE 课程 = a.课程 AND 学号 a.学号 AND 成绩 a.成绩 ) 3 www.2cto.com ) AS b GROUP BY 课程 提取表中每个分组的前几条数据 SELECT 课程, SUM(奖金) AS 奖金FROM ( SELECT 课程, 学号, 成绩 FROM 考试 AS a WHERE ( SELECT COUNT(*) FROM 考试 WHERE 课程 = a.课程 AND 学号 a.学号 AND 成绩 > a.成绩 ) ) AS bGROUP BY 课程 09-14 00:36