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'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? Please help.
Thanks in advance
 
Hi,

This may work for you.

Code:
SELECT Devices, SUM(`Events`) AS Total FROM devices
GROUP BY Devices
ORDER BY Total DESC LIMIT 1

Regards,

Peter.

Remember- It's nice to be important,
but it's important to be nice :)
 
Thanks Peter - It works.
One more thing is I need to display the result between the 1st of the month - 30th of the month and year should be 2010.

Thanks
 
Run the query on any day this year except for 31st March, 31st May, 31st July, 31st August, 31st October and 31st December.

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top