select 班级,姓名,成绩 from (
select t.*, row_number() over(partition by t.班级 order by t.成绩 desc) as num
from 表 t
order by t.班级g, t.成绩 desc
) where num<=3
select t.*, row_number() over(partition by t.班级 order by t.成绩 desc) as num
from 表 t
order by t.班级g, t.成绩 desc
) where num<=3