Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get the 'top ten' from a SELECT count(*)
Carsten Jacobs wrote:
>
> Hello!
>
> I want to make something like a top ten list.
> Does anybody hava a smart idea to get only the first ten rows of a
> select like
>
> SELECT count(*) amount, country
> FROM customer
> GROUP by customer
> ORDER by amount
>
> Thanks for any help
>
> Carsten
select * from (
SELECT count(*) amount, country
FROM customer
GROUP by customer
ORDER by amount
)
where rownum < 11
for 8i and above. There are also new analytic functions available from 8i.2 onwards.
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk We are born naked, wet and hungry...then things get worseReceived on Tue Apr 25 2000 - 00:00:00 CDT
![]() |
![]() |