Share my simple solution using MAX


  • 0
    D

    select max(Salary)
    from Employee
    where Salary <> (select max(Salary) from Employee);


  • 0
    M

    what if the table contains duplicate max?
    for example:
    ID Salary
    1 300
    2 300
    3 200
    under this condition, how do we define "the second"?


Log in to reply
 

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