第二高的薪水
https://leetcode-cn.com/problems/second-highest-salary/
两种方法:
select?(
????select?distinct?Salary
????from?Employee
????order?by?Salary?DESC
????limit?1,1)?
as?SecondHighestSalary;?--?嵌套一层,为了获取跟预期结果中的?null?对应
select max(Salary) SecondHighestSalary
from Employee
where Salary <> (select max(Salary) from Employee );
作者:zuihai
链接:https://leetcode-cn.com/problems/second-highest-salary/solution/xian-qu-diao-di-yi-zai-qiu-zui-gao-tong-shi-jie-ju/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
原文:https://www.cnblogs.com/wudanyang/p/13071979.html