题解 | #统计各个部门的工资记录数#
对所有员工的薪水按照salary降序进行1-N的排名
http://www.nowcoder.com/practice/b9068bfe5df74276bd015b9729eec4bf
select a.emp_no,a.salary,(
select count(distinct c.salary) from salaries c where c.salary>=a.salary
) t_rank
from salaries a
order by a.salary desc,a.emp_no asc
select count(distinct c.salary) from salaries c where c.salary>=a.salary
) t_rank
from salaries a
order by a.salary desc,a.emp_no asc