知识点
- 第二多员工可能有多人salary= 筛选出所有人
- 薪水排序前忽略重复项用distinct
代码
select emp_no, salary
from salaries
where salary =(
select distinct salary
from salaries
order by salary DESC
limit 1,1)
and to_date = '9999-01-01'
select emp_no, salary
from salaries
where salary =(
select distinct salary
from salaries
order by salary DESC
limit 1,1)
and to_date = '9999-01-01'