DrJohnZoidberg
Honorary Master
I cannot seem to get this one figured out fully.
I need to group records together that fall within a certain time period, for instance all the records that were added within an hour of each other.
Let's say I have theses records:
I want to now get these grouped so it should look like this:
As you can see the first three records all fall within an hour of each other and the last two also do but on a different day.
Grouping by day wouldn't work, because the one date is on the previous day.
Any help would be appreciated.
I need to group records together that fall within a certain time period, for instance all the records that were added within an hour of each other.
Let's say I have theses records:
Code:
USERNAME POINTS DATESTAMP
USER1 50 2014-01-16 23:59:03
USER1 22 2014-01-17 00:01:04
USER1 16 2014-01-17 00:19:17
USER1 11 2014-01-31 15:12:00
USER1 34 2014-01-31 15:19:34
I want to now get these grouped so it should look like this:
Code:
USERNAME POINTS
USER1 88
USER1 45
As you can see the first three records all fall within an hour of each other and the last two also do but on a different day.
Grouping by day wouldn't work, because the one date is on the previous day.
Any help would be appreciated.