select *, max(成绩)over(partition by 科目 order by 成绩 desc)) as max_score from table 漏了个AS吧?