Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Top N Results From Aggregate Values in A Select
On Wed, 07 Dec 2005 17:48:07 -0330, Tim Marshall
<TIMMY!@PurplePandaChasers.Moertherium> wrote:
>HI everyone, I think this should be easy - my reference book seems to be
>discussing using ranking functions to be able to obtain the top N
>results. I'm not sure if that applies here as I haven't done this in
>Oracle before. As an example, consider the following statement. It
>returns about 150+ rows. I would like the top 10 "Space owners" with
>the most requests:
>
>SELECT
>count(*) "Request",
>cn_Name "Space Owner"
>FROM
>tma.f_workorder, tma.f_clients
>WHERE
>wo_type_code IN ('1', 'A')
>wo_cn_fk = cn_pk(+)
>GROUP BY
>cn_name
>
>Thanks very much for any help on this!
Just search for 'Top N' in this forum and you will get several solutions. Evidently you didn't do this and posted your question right away.
-- Sybrand Bakker, Senior Oracle DBAReceived on Wed Dec 07 2005 - 16:44:02 CST
![]() |
![]() |