Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Please explain this query
shihab wrote:
> This is the query to findout Nth Max (Highest) value from a table
>
> SELECT sal from emp t
> WHERE &n = (SELECT COUNT(sal)
> FROM (SELECT DISTINCT sal FROM emp)
> WHERE t.sal<=sal);
>
> Can anybody expalin how this query works.....
>
>
> Thanks in advance
> Shihab
>
If you cannot see how it works by inspection alone, get out the old
pencil and paper, make up an EMP table with, say, four numbers, and
execute the query by hand, with an SQL manual at your side.
N. Shamsundar
University of Houston
Received on Thu Oct 13 2005 - 16:48:11 CDT
![]() |
![]() |