get kth largest element sql dense rank code example
Example 1: n highest salary in sql
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP N salary
FROM #Employee
ORDER BY salary DESC
) AS temp
ORDER BY salary
Example 2: n highest salary in sql
SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1