Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Specifying the maximum number of rows retrieved from a query?
Al Chase wrote:
> SELECT A.COLX FROM DATABASE.TABLENAME A
> WHERE ROWNUM < 3;
> ORDER BY A.DATE DESC;
>
> This worked correctly on several tables I hve which contain date
> fields. If you use 'order by' you will get the first 2 articles rather
> than the last two. DESCending does the trick
Are you quite sure? I seem to remember that rownum is evaluated before the results are sorted, in which case that wouldn't work. Received on Sat Feb 01 1997 - 00:00:00 CST