题目描述:
https://leetcode-cn.com/problems/second-highest-salary/
方法一:
select (select distinct Salary from Employee order by Salary desc limit 1,1) as SecondHighestSalary;
方法二:
select max(Salary) as SecondHighestSalary from
(select Salary from Employee where Salary!=(select max(Salary) from Employee)) tmp;
修订版:
select max(Salary) SecondHighestSalary
from Employee
where Salary!=(select max(Salary) from Employee);