Jump to content

[SOLVED] Statistics Gathering By DateTime


lead2gold

Recommended Posts

Is it possible to retrieve hourly (or on an interval) statistics from the database?

For example...

assume the following table simplified to show all the fields i require info from):

table a
{
    pkey BIGINT(20);
    userId CHAR(4);
    logEntry DATETIME;
}

I want to be able to see how many entries there are for user 'XXXX' ever hour... for a given time range.

thus... the output looking something like:

intervalf | intervalt | count
2007-12-31 00:00:00 | 2007-12-31 01:00:00 | 12
2007-12-31 01:00:00 | 2007-12-31 02:00:00 | 112
2007-12-31 02:00:00 | 2007-12-31 03:00:00 | 12
2007-12-31 03:00:00 | 2007-12-31 04:00:00 | 132
... etc

 

is this possible?

 

Chris

 

p.s. Happy new year! :)

Link to comment
Share on other sites

Thanks, i solved it actually;  The purpose of it is to generate statistics that certain actions took place on our system at any given hour, or for a specified number of hours.

 

I had to iterate through the date-time they specified and dump the results into a temporar table.

 

From there i could generate all the statistics i ever needed from the new temporary table. The statistics are used for in-house so the overhead fo the temporary table isn't a problem since only few people have access to run the generation.

 

Thanks though for your feedback.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.