Jump to content

Pull data from certain hours


benphelps

Recommended Posts

I'm trying to pull data from a table between certain hours of a day.

 

Here is the SQL i have now:

 

SELECT sum(bytes) FROM traffic WHERE ip = '${ip}' AND measuringtime > ( NOW() - INTERVAL ${hour} HOUR) GROUP BY ip

 

This sends the data back for the past hour.  I need to modify it to send the data for one hour of a day.

 

Here is how to do it in a sentence form.  I just dont know how to get that to MySQL.

 

Select the sum of bytes from traffic where IP is equal to A and measuringtime is between hours 2 and 3 of the past day.

 

This is the format of the "measuringtime" column: 2009-08-03 20:23:01

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.