select emp_no , salary from salaries where salary=(select salary from salaries where to_date='9999-01-01' group by salary order by salary desc limit 1,1);
子查询中:
1、限定条件 where to_date=‘9999-01-01’
2、薪水可能有多个,此处用group by去重
3、order by降序排序
4、limit 选出排名第二的薪水
主查询中:
1、salary=第二高的薪水,如果第二个高的薪水有多个人,也可以删选出来。