Simple accepted answer here, don't forget DISTINCT or you'll get wrong answer


  • 0
    J
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
    SET N = N-1;
      RETURN (
          # Write your MySQL query statement below.
          select distinct Salary from Employee
          order by Salary desc limit N,1
      );
    END
    

Log in to reply
 

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