Find out nth highest salary from emp table

Showing Answers 1 - 29 of 29 Answers

Ajay

  • Mar 24th, 2005
 

select sal from emp e where n-1=(select count(distinct sal) from emp where sal>e.sal);

AjayLebaka

  • Mar 26th, 2005
 

select sal from emp
wherenulln-1=(select count( distinct sal) from emp where  
sal>E.sal);

  Was this answer useful?  Yes

padma

  • Mar 23rd, 2006
 

select max(sal) from (select distinct sal from emp where rownum<=(n+1) order by sal)

where n is the nth position.

  Was this answer useful?  Yes

Shiv Mangal Rahi

  • Jul 24th, 2006
 

Hi,

Try this one.I hope u could able to get it

SQL> select min(sal) from (select sal from emp order by sal desc)
 where rownum<n+1;

Sangeeta

  • Jun 1st, 2007
 

this is the best solution to find out nth highest solution : select min(sal) from emp where sal in (select sal from (select sal from emp order by sal desc) where rownum <=&n )

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions