题解 | #获取当前薪水第二多的员工的emp_no以及其对应的薪水salary#

获取当前薪水第二多的员工的emp_no以及其对应的薪水salary

http://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db

方法1:

SELECT t3.emp_no ,t3.salary from salaries t3
where t3.salary = ( SELECT t1.salary from salaries t1 GROUP BY t1.salary ORDER BY t1.salary desc LIMIT 1,1 )

方法2:

SELECT t3.emp_no ,t3.salary from salaries t3 where t3.salary = ( SELECT t2.salary from salaries t2 where t2.salary < ( SELECT max(t1.salary) from salaries t1 ) ORDER BY t2.salary desc limit 1 )

全部评论

相关推荐

我见java多妩媚:大外包
点赞 评论 收藏
分享
点赞 1 评论
分享
牛客网
牛客企业服务