1.

How To Display Nth Highest Salary From A Table In A Mysql Query?

Answer»

Let us take a table named employee.

To find Nth highest salary is:
1. select DISTINCT(salary) from employee order by salary DESC limit n-1,1

if you WANT to find 3rd largest salary:
1. select distinct(salary) from employee order by salary desc limit 2,1 

Let us take a table named employee.

To find Nth highest salary is:
1. select distinct(salary) from employee order by salary desc limit n-1,1

if you want to find 3rd largest salary:
1. select distinct(salary) from employee order by salary desc limit 2,1 



Discussion

No Comment Found