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: <syakobson_at_erols.com>
Date: 1997/10/31
Message-ID: <878345667.17558@dejanews.com>#1/1

Did you try it yourself?
ORDER BY clause can not be used in a subquery.

Solomon Yakobson.

In article <345ad83d.52849448_at_news.erols.com>,   gwong_at_erols.com wrote:
>
> 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

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Fri Oct 31 1997 - 00:00:00 CST

Original text of this message

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