题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#
获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
http://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db
1. 能用group by 不用distinct
2.开始没有考虑多人薪水相同的情况:
select emp_no, salary from salaries order by salary desc limit 1, 13. 考虑多人薪水相同:
select emp_no, salary from salaries where to_date = '9999-01-01' and salary = ( select salary from salaries group by salary order by salary desc limit 1,1)先分组在打印打印的就是一组的情况了