with t1 as (select job,(count(score)+1)/2 num from grade group by job) -- 取出每个job组中的中位数,5个中位数是3,4个就是2.5 select id,job,score,t2 from (select id,job,score, row_number()over(partition by job order by score desc)t2, num from grade g join t1 using(job))a --添加开窗排序函数,并和t1连接 where if(num=round(num,0),t2 = ...