Why we cant do it using Row_number()


  • 0
    H
    CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
    BEGIN
      RETURN (
          # Write your MySQL query statement below.
          Select salary from 
          (Select Row_Number() over (Order by Salary Desc) Salaryrank, Salary From Employee) as Tmp
          Where Salaryrank = N
          
      );
    END

  • 0
    J

    @heta2 why Row_number() is not allowed on this site?


Log in to reply
 

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