题解 | #对所有员工的薪水按照salary降序进行1-N的排名#

对所有员工的薪水按照salary降序进行1-N的排名

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

 select emp_no,salary,dense_rank()over(order by salary desc) as t_rank
 from salaries
 where to_date = '9999-01-01'
 order by salary desc,emp_no asc
  • 提醒自己:虽然窗口函数中对salary排序过,但最后也要按照题意对salary降序排序
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务