aspose file tools*
The moose likes Oracle/OAS and the fly likes find second largest value in a column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "find second largest value in a column " Watch "find second largest value in a column " New topic
Author

find second largest value in a column

rakesh repala
Greenhorn

Joined: May 23, 2008
Posts: 5
please help me find the second largest value in a column

write a query using oracle 8i


rakesh
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2503
    
    8

Hi Rakesh,
Did you try to write such a query yourself?
Can you show us how far you got?

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
rakesh repala
Greenhorn

Joined: May 23, 2008
Posts: 5
select sal from emp e1 where 2=(select count* from emp e2 where e1.sal>e2.sal)

regards
------
pradeep singh
Ranch Hand

Joined: Oct 23, 2007
Posts: 339
Hi



Select sal from (select max(sal) from emp)
where ROWCOUNT<=1
order by sal desc


I think it will work fine to get second highest salary .


SCJP 5.0(75%), SCWCD 5.0(88%)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: find second largest value in a column