• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

find second largest value in a column

 
rakesh repala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help me find the second largest value in a column

write a query using oracle 8i
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rakesh,
Did you try to write such a query yourself?
Can you show us how far you got?

Regards, Jan
 
rakesh repala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select sal from emp e1 where 2=(select count* from emp e2 where e1.sal>e2.sal)

regards
------
 
pradeep singh
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic