select t.id id,name,score from(select g.id,name,score,dense_rank()over(partition by name order by score desc) dk from grade g left join language l on g.language_id=l.id) t where dk=1 or dk=2 order by name,score desc,t.id
select t.id id,name,score from(select g.id,name,score,dense_rank()over(partition by name order by score desc) dk from grade g left join language l on g.language_id=l.id) t where dk=1 or dk=2 order by name,score desc,t.id