homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

Get count of top records for a record in MySQL

5+ Year Member

Msg#: 4126231 posted 12:27 pm on May 3, 2010 (gmt 0)

I'm working on the development of a system to track technology assets, as well as any events that occur with the systems (errors, config changes, etc). I want to create a graph (using google charts) that will show which devices have the most events. So there would be like the top 5 devices listed on the x-axis of the graph and then the bar graph would show how many events those top five have had. I'm using a MySQL database, but am not sure how to approach this query.

Any help would be appreciated.



WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4126231 posted 5:36 pm on May 4, 2010 (gmt 0)

It's a matter of getting the data out of your database, then formatting it in the way your charting library needs it. Most of the formatting work is best done with a server side scripting language (like PHP, Perl, or ASP) not by MySQL itself.

I would start playing around with it and post back when you run into trouble. :)


5+ Year Member

Msg#: 4126231 posted 10:36 pm on May 18, 2010 (gmt 0)

Something like this might work, assuming that the chart control would be able to limit the result set to fit the graph.

select asset_name, count(event_id)
assets a
,events e
a.asset_id = e.asset_id
group by asset_name

I personally would just use qlikview, they have a free personal version.
It is better than sliced bread!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved