题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db
先对salary
进行限制,取排第二的薪水,再以emp_no
进行排序
SELECT s.emp_no,s.salary
FROM salaries s
WHERE s.salary = (
SELECT DISTINCT salary from salaries
order by salary DESC
LIMIT 1,1
)
ORDER BY s.emp_no;