题解 | #获取当前薪水第二多的员工的emp_no
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
https://www.nowcoder.com/practice/c1472daba75d4635b7f8540b837cc719
select emp_no,salary,last_name,first_name from (select em.emp_no,sa.salary,em.last_name,em.first_name from employees em join salaries sa on em.emp_no=sa.emp_no) ak where salary= /*where条件筛选等于工资最高的*/ ( select max(salary) from (select em.emp_no,sa.salary,em.last_name,em.first_name from employees em join salaries sa on em.emp_no=sa.emp_no) ak /*排除最高的工资后,工资最高的*/ where salary!= (select max(salary) from (select em.emp_no,sa.salary,em.last_name,em.first_name from employees em join salaries sa on em.emp_no=sa.emp_no) ak)) /*先找出工资最高的*/