Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Limiting the resultset returned from a SELECT to the first N rows?

Re: Limiting the resultset returned from a SELECT to the first N rows?

From: Gee M Wong <gwong_at_erols.com>
Date: 1997/10/29
Message-ID: <345ad83d.52849448@news.erols.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US