benphelps Posted August 6, 2009 Share Posted August 6, 2009 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 More sharing options...
fenway Posted August 10, 2009 Share Posted August 10, 2009 What you have seems correct... does it not work? Link to comment https://forums.phpfreaks.com/topic/169032-pull-data-from-certain-hours/#findComment-894756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.