有一个薪水表salaries简况如下:
对所有员工的薪水按照salary进行按照1-N的排名,相同salary并列且按照emp_no升序排列:
select s1.emp_no,s1.salary,count(distinct s2.salary)as t_rank from salaries s1
inner join salaries s2 on s1.salary <=s2.salary
group by s1.emp_no
order by s1.salary DESC,s1.emp_no asc