题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db
方法一:dense_rank函数
select emp_no,salary from
(select emp_no,salary,dense_rank() over(order by salary desc) t
from salaries) as ss
where t=2
方法二:max函数
select emp_no, max(salary)
from salaries
where salary !=(select max(salary) from salaries)