题解 | #找出每个学校GPA最低的同学#

考试分数(五)

http://www.nowcoder.com/practice/b626ff9e2ad04789954c2132c74c0512

select id,job,score,r
from(select job,s,if(c%2=1,s,s+1) g
from
(select job,max(r) c,round(case when max(r)%2=1 then (max(r)+1)/2
when max(r)%2=0 then max(r)/2 end,0) s
from
(select job,score,dense_rank()over(partition by job order by score desc) r
from grade
) a
group by job
 )b
 )d right join (select id,job,score,dense_rank()over(partition by job order by score desc) r
from grade
) a using(job)
where r=s or r=g
order by id
全部评论

相关推荐

10-07 23:57
已编辑
电子科技大学 Java
八街九陌:博士?客户端?开发?啊?
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务