176 第二高的薪水

题目:在一个员工表中查询薪水第二高的人 作为SeconHighestSalary字段返回

解法一:

select max(Salary) as SecondHighestSalary from Employee where Salary<(select max(Salary) from Employee);

解法二:

select IFNULL((select Distinct Salary from Employee order by Salary DESC limit 1,1),null) as SecondHighestSalary

大佬链接 https://blog.csdn.net/qq_40803710/article/details/80302535

猜你喜欢

转载自blog.csdn.net/qq_41281571/article/details/81783696