What is the simplest way to get the nth highest value from a result set using plain SQL?
The result set would be huge, thus need to consider performance too.>
Sub Query will list out top 'n' highest salary values. From that list minimum value will be the nth highest salary.
`SELECT min(salary) FROM
(SELECT DISTINCT TOP n salary FROM EmployeeTable ORDER BY salary desc);`
Eg :- SQL query to find third maximum salary
`SELECT min(salary) FROM
(SELECT DISTINCT TOP 3 salary FROM EmployeeTable ORDER BY salary desc);`