Solution for second highest salary


  • 0
    V

    select

    CASE WHEN EXISTS (SELECT max(Salary) from Employee where salary not in (select max(Salary) from Employee)) THEN (SELECT distinct(max(Salary)) from Employee where Salary not in (select max(Salary) from Employee))
    ELSE null
    END as 'SecondHighestSalary'
    FROM Employee limit 1;

    FROM Employee limit 1;


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.