SQL query to find Nth highest salary from a salary table

Try this, n would be the nth item you would want to return

 SELECT DISTINCT(Salary) FROM table ORDER BY Salary DESC LIMIT n,1

If you want to find nth Salary from a table (here n should be any thing like 1st or 2nd or 15th highest Salaries)

This is the Query for to find nth Salary:

SELECT DISTINCT Salary FROM tblemployee ORDER BY Salary DESC LIMIT 1 OFFSET (n-1)

If you want to find 8th highest salary, query should be :

SELECT DISTINCT Salary FROM tblemployee ORDER BY Salary DESC LIMIT 1 OFFSET 7

Note: OFFSET starts from 0th position, and hence use N-1 rule here


To get nth highest salary you need to first sort data by using ORDER BY and then select the nth highest record using LIMIT with OFFSET.

SELECT DISTINCT(salary) AS salary
FROM tbl_salary
ORDER BY salary DESC
LIMIT 1 OFFSET (n - 1);