题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/c1472daba75d4635b7f8540b837cc719
#先求出max工资 然后求出不等于max工资的 工资的 max值,就是第二多的薪资
select t.emp_no, t.salary, t.last_name, t.first_name
from (select employees.emp_no, salary, last_name, first_name
from employees inner join salaries
on employees.emp_no = salaries.emp_no) as t
where salary =
(select MAX(salary) from
(select salary from salaries
where salary !=
(select MAx(salary) FROM salaries)) as s);