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

Home -> Community -> Usenet -> c.d.o.misc -> SQL Question: Return top 5

SQL Question: Return top 5

From: Sean Dolan <dolans_at_stripe.Colorado.EDU>
Date: 26 Aug 98 15:17:50 GMT
Message-ID: <dolans.904144670@stripe.Colorado.EDU>

        I have the following SQL statement that works great: select first_name|| ' ' || last_name fullname, count(*) from incidents GROUP BY first_name|| ' ' || last_name ORDER BY 2 DESC;

which returns

Fullname         Count
Person X          25
Person Y	  12
Person Z          6
Person AA	  5
Person BB 	  2

etc... the problme is that this query will return ALL my names in the table and their respective counts... how could I get it to display just the top 5 names. It's probably basic, but I could not find any documentation on how to do it.

Thanks again - and for those who replied on my last question, THANK YOU!

Sean Received on Wed Aug 26 1998 - 10:17:50 CDT

Original text of this message

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