Home » SQL & PL/SQL » SQL & PL/SQL » Retrieve Ton N rows using aggregate functions.(merged 3)
Retrieve Ton N rows using aggregate functions.(merged 3) [message #384883] Thu, 05 February 2009 11:44 Go to next message
vjeedigunta
Messages: 201
Registered: March 2005
Location: Hyderabad
Senior Member

02/05/2009 ALERTS@ Xe> select metric_name, count(*) from main_alert group by metric_name order by 2 desc ;

METRIC_NAME COUNT(*)
---------------------------------------------------------------- ----------
Response 249
Database Limits 245
User Block 215
Tablespaces Full 189
Filesystems 174
User-Defined SQL Metrics 150
Alert Log 134

how to make it retrieve only top 5.

Thanks in advance,
VJ
Re: Retrieve Ton N rows using aggregate functions.(merged) [message #384889 is a reply to message #384883] Thu, 05 February 2009 11:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is no difference with another top N question, just put your query in an inline view, for instance.

Regards
Michel
Re: Retrieve Ton N rows using aggregate functions. [message #384894 is a reply to message #384883] Thu, 05 February 2009 12:05 Go to previous message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you.

This is a FAQ so use SEARCH
Previous Topic: SQL plus report in excel format
Next Topic: pl/sql Optimization
Goto Forum:
  


Current Time: Sat Dec 10 20:52:00 CST 2016

Total time taken to generate the page: 0.05213 seconds