Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with mysql query

Status
Not open for further replies.

vicmad

Technical User
Feb 11, 2010
13
CA
I had submitted this before:
I'm running SNMP Zenoss connected to mysql database.I'm trying to select the device that fails the most from the
database.
Column name called "devices" has all the device names.
Column name called "events" has all the events that are generated.
How can i write a query that will display the device that fails the most in a month?

petrosky suggested the below query:
SELECT Devices, SUM(`Events`) AS Total FROM devices
GROUP BY Devices
ORDER BY Total DESC LIMIT 1

The above query works and displays the device that fails the most.
What I also need is that it should display the event from the "events" column.

Please help and thanks in advance.
 
Please Help and Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top