Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Top 10 rows from a sorted resultset
BVince2172 wrote:
> Using Oracle 8i, how would I return the first n rows in a query after an order
> by? In Transact-SQL there's TOP, but as far as I am aware this isn't available
> in Oracle.
>
> It's simple enough to do without the order by:
>
> SELECT Name, DOB
> FROM tMyTable
> WHERE rownum <11
>
> ...to return the first 10 rows, but with an order by the results are ordered
> AFTER cutting the first 10 rows.
Use an in-line view ... known in TSQL as a derived table.
SELECT *
FROM (
your select statement here with the order by clause )
Daniel Morgan Received on Thu Aug 22 2002 - 11:03:28 CDT