Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: ORDER BY + ROWNUM error
hi,
Erwin Dondorp wrote:
>
> Dino,
>
> The ORDER BY clause is executed AFTER the ROWNUMs are assigned.
> This means that the ROWNUMs are assigned more or less at random,
> but certainly not on a way that is related to the ORDER BY clause.
>
> The alternative is to open a cursor and to fetch only the first
> 3 records.
>
> Erwin
>
or try this
select empno, sal
from ( select empno, sal
from emp order by sal desc )
ciao
andreas
Received on Thu Jun 28 2001 - 06:16:52 CDT