Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to use 'Top' in oracle?
There is a change in 8.1, and rownum can be applied after order by, but I think you have to use an inline view to achieve it, viz:
select * from
(
select product_name
from product
order by price DESC
)
where rownum<=3
;
This is a side-effect of allowing ORDER BY inside views rather than an explicit re-implementation of the ROWNUM concept.
-- Jonathan Lewis Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk Niall Litchfield wrote in message <8qpsat$4j5$1_at_soap.pipex.net>...Received on Tue Sep 26 2000 - 05:20:07 CDT
>"NetComrade " <andreyNSPAM_at_bookexchange.net> wrote in message
>news:37ed628d.26437414_at_news.earthlink.net...
>> select product_name from product order by price where rownum<=3 in 8i
>> only.
>
>Does this mean that rownum has changed in 8i to work on the basis of rank.
I
>must have missed that one if it did, and I kinda doubt it. Jonathon and
>basavaraj have given the two text book ways to achieve this.
>
>
>--
>Niall Litchfield
>Oracle DBA
>Audit Commission UK
>
>
![]() |
![]() |