| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Top 10 records
>From a database or from a table? Define TOP.
By definition a heap table is an unordered collection of rows so to assign an order you most use an order by clause.
To limit the output to the first ten rows Oracle happens to find:
select * from table_a where rownum < 11;
To find the top ten salaries in the company then something like
select ename, sal
from ( select ename, sal from emp order by sal desc )
where rownum < 11;
HTH -- Mark D Powell -- Received on Tue Apr 04 2006 - 18:05:27 CDT
![]() |
![]() |