题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/c1472daba75d4635b7f8540b837cc719
首先去除最高工资,然后算出第二高工资,最后表子查询筛选第二高工资即可 select y.emp_no,v.salary,y.last_name,y.first_name from employees as y left join salaries as v on y.emp_no=v.emp_no where v.salary= (select max(t.salary) as 第二高工资 from salaries as t where t.salary<>(select max(h.salary) from salaries as h));