DEV Community

Muthu
Muthu

Posted on

[SQL] Find N'th largest record without LIMIT

SELECT * 
FROM employee_info e1
WHERE N-1 = 
   (
      SELECT COUNT(DISTINCT salary)
      FROM employee_info e2
      WHERE e1.salary < e2.salary
    )
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)