name salary
----- -----
mohan 500
ram 1000
dinesh 5000
hareesh 6000
mallu 7500
manju 7500
praveen 10000
hari 10000
How would I find the nth-highest salary from the aforementioned table using Oracle?
name salary
----- -----
mohan 500
ram 1000
dinesh 5000
hareesh 6000
mallu 7500
manju 7500
praveen 10000
hari 10000
How would I find the nth-highest salary from the aforementioned table using Oracle?
DECLARE M INT; SET M=N-1; SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M,1;
General query for all Database
Replace n with the given number. for example to get the 3rd highest salary
OR
in any programming language
select * from emp order by salary
then iterate the result set in programming language (JAVA, .net or php)
Mysql
Select n-th highest salary in a simple way
Where n = the n-th number u want.....
In Sql server 2012 and above. Please Refer this link for Fetch, Offset, Sql server Page
Look here