title: Group by date range on weeks/months interval
body: <p>I'm using MySQL and I have the following table:</p>
  
  <pre><code>| clicks | int  |
  |   period  | date |
  </code></pre>
  
  <p>I want to be able to generate reports like this, where periods are done in the last 4 weeks:</p>
  
  <pre><code>|   period    | clicks |
  |  1/7 - 7/5  |  1000  | 
  | 25/6 - 31/7 |  ....  |
  | 18/6 - 24/6 |  ....  |
  | 12/6 - 18/6 |  ....  |
  </code></pre>
  
  <p>or in the last 3 months: </p>
  
  <pre><code>| period | clicks |
  |  July  |  ....  |
  |  June  |  ....  |
  | April  |  ....  |
  </code></pre>
  
  <p>Any ideas how to make select queries that can generate the equivalent date range and clicks count?</p>