GROUP BY interval overlapping timestamp MySQL query
问题 I've been reading other questions and had no luck. I have a table with columns (stamp,value). The 'stamp' column stores hourly timestamps. What I'm trying to do is to retrieve SUM(value) for intervals of 24 hours depending on a range of timestamps specified in the query: SELECT stamp, Sum(value) FROM table WHERE stamp >= Date_sub('2012-12-02 05:00:00', INTERVAL 1 day) AND stamp < '2013-01-01 05:00:00' GROUP BY Date(stamp) The result I'm looking for would look like this: stamp value 2012-12-02