Home » RDBMS Server » Server Administration » higest value
higest value [message #374846] Thu, 05 July 2001 23:56 Go to next message
ravibabu
Messages: 12
Registered: July 2001
Junior Member
How do we get the fifth highest sal from emp table
Re: higest value [message #374850 is a reply to message #374846] Fri, 06 July 2001 05:48 Go to previous messageGo to next message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi Mr.Ravi,
The query to find 5th maximum is

select min(sal) from (select distinct sal from emp order by sal desc ) where rownum < 6

Regards
S.Thirumalai
Re: higest value [message #374851 is a reply to message #374846] Fri, 06 July 2001 05:50 Go to previous message
M.Nageswara rao
Messages: 1
Registered: July 2001
Junior Member
Hi Ravi
I think the Following Query May useful for u

SELECT * FROM EMP A
WHERE 4 = (
SELECT Count(*)
FROM EMP
WHERE Sal > A.Sal)
ORDER BY SAL DESC
/

Regards
Nageswara rao.M
Previous Topic: case
Next Topic: case
Goto Forum:
  


Current Time: Mon Dec 23 20:11:59 CST 2024