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?
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 UsenetReceived on Fri Oct 31 1997 - 00:00:00 CST