Group by date range on weeks/months interval
Posted
by khelll
on Stack Overflow
See other posts from Stack Overflow
or by khelll
Published on 2010-06-10T08:47:32Z
Indexed on
2010/06/10
8:53 UTC
Read the original article
Hit count: 276
I'm using MySQL and I have the following table:
| clicks | int |
| day | date |
I want to be able to generate reports like this, where periods are done in the last 4 weeks:
| period | clicks |
| 1/7 - 7/5 | 1000 |
| 25/6 - 31/7 | .... |
| 18/6 - 24/6 | .... |
| 12/6 - 18/6 | .... |
or in the last 3 months:
| period | clicks |
| July | .... |
| June | .... |
| April | .... |
Any ideas how to make select queries that can generate the equivalent date range and clicks count?
© Stack Overflow or respective owner