题解 | #考试分数(四)#

考试分数(四)

http://www.nowcoder.com/practice/502fb6e2b1ad4e56aa2e0dd90c6edf3c

SELECT job, 
ROUND((CASE WHEN COUNT(r) % 2=1 
		THEN (COUNT(r)/2)+0.5 ELSE (COUNT(r)/2 END),0) AS start, 
ROUND((CASE WHEN COUNT(r) % 2=1 
		THEN (COUNT(r)/2)+0.5 ELSE (COUNT(r)/2)+1 end),0) AS end 
FROM
	(SELECT job, RANK() OVER(PARTITION BY job ORDER BY score) r FROM grade
	 GROUP BY job, score) re
GROUP BY job
ORDER BY job
全部评论

相关推荐

Pandaileee:校友加油我现在也只有一个保底太难了
点赞 评论 收藏
分享
10-21 23:48
蚌埠坦克学院
csgq:可能没hc了 昨天一面完秒挂
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务