This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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: 2543
    
  10

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
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: find second largest value in a column
 
jQuery in Action, 3rd edition