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 -> Top N Results From Aggregate Values in A Select

Top N Results From Aggregate Values in A Select

From: Tim Marshall <TIMMY!_at_PurplePandaChasers.Moertherium>
Date: Wed, 07 Dec 2005 17:48:07 -0330
Message-ID: <dn7jif$5k5$1@coranto.ucs.mun.ca>


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!

-- 
Tim    http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto  "TIM-MAY!!" - Me
Received on Wed Dec 07 2005 - 15:18:07 CST

Original text of this message

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