Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Top N Results From Aggregate Values in A Select

Re: Top N Results From Aggregate Values in A Select

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 07 Dec 2005 23:44:02 +0100
Message-ID: <pbpep1h0gll3a640o9e4bqh6j30hu6v3ub@4ax.com>


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 DBA
Received on Wed Dec 07 2005 - 16:44:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US