继续刷LeetCode,第176题,求表中第二大的数
分析:
首先在表中找到最大的数,然后在剩余的表中,找到最大的,结果就是第二大的那个数。
附上代码:
# Write your MySQL query statement below
select MAX(Salary) as SecondHighestSalary
from Employee
where Salary<(select MAX(Salary) from Employee);
继续刷LeetCode,第176题,求表中第二大的数
分析:
首先在表中找到最大的数,然后在剩余的表中,找到最大的,结果就是第二大的那个数。
附上代码:
# Write your MySQL query statement below
select MAX(Salary) as SecondHighestSalary
from Employee
where Salary<(select MAX(Salary) from Employee);