Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> find the second largest element
Dear friend, I like to write a query that will find the largest and the second largest values of a column in a group by setting.
For example,
Table a
id sal
001 1000
001 1000
001 500
002 200
002 400
002 500
...
I want to get
id maxsal secmaxsal
001 1000 1000
002 500 400.
Thanks.
hongjiew_at_aol.com Received on Mon Nov 20 2000 - 15:45:37 CST
![]() |
![]() |