考虑到第二名不止一个,需要使用子查询,分组,排序,salary等于分组排序后的第二名薪水。
select emp_no
, salary
from salaries
where salary =
(
select salary
from salaries
group by salary
order by salary desc
limit 1,1
)
考虑到第二名不止一个,需要使用子查询,分组,排序,salary等于分组排序后的第二名薪水。
select emp_no
, salary
from salaries
where salary =
(
select salary
from salaries
group by salary
order by salary desc
limit 1,1
)