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
https://forums.phpfreaks.com/topic/169032-pull-data-from-certain-hours/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.