Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Limiting the resultset returned from a SELECT to the first N rows?
Try
SELECT * FROM
(SELECT * FROM TABLE ORDER BY AMOUNT)
WHERE ROWNUM <= 10;
The nested query is necessary, because ORACLE assigns row numbers to the result set befire any sorting is peformed.
On Tue, 28 Oct 1997 01:27:36 -0500, "Michael G. Schneider" <mgs_software_at_compuserve.com> wrote:
>I would like to write a SELECT statement and limit the number of
returned
>rows. Something like
>
> SELECT * FROM tbl ORDER BY amount TOP 10
>
>Is this possible?
>
>Michael G. Schneider
>
>mgs_software_at_compuserve.com
Gee M Wong
Technical Architect
CSC Consulting & Systems Integration
gwong_at_erols.com
gwong_at_csc.com
Received on Wed Oct 29 1997 - 00:00:00 CST