title: How to group by month by providing a start date and an end date?
body: <p>I am using the following query.</p>
  
  <pre><code>select DATE_FORMAT(created_at, '%Y-%m') AS month, sum(points) from table_name group by month;
  </code></pre>
  
  <p>I am getting the sum of points but the result is not consistent with the result I get when I try by a date range . Eg,</p>
  
  <pre><code>select sum(points) from table_name where '2015-01-01 00:00:00' &lt;= date(created_at) &lt;= '2015-01-31 23:59:59';
  </code></pre>
  
  <p>The result of Jan, 2015 by 1st and 2nd query above are not same. Where is the problem in the first query?</p>