title: How to discover the sum of each day of a month in MySQL?
body: <p>Lets suppose we have a table (for example <code>sales</code>) with three fields <code>id</code> (int, primary), <code>price</code> (double), <code>date</code> (datetime).</p>
  
  <p>How can we get the sum of the <code>price</code> attribute to each day of the current month?</p>
  
  <p>And to the last month?</p>
  
  <p>I need a return with something similar too:</p>
  
  <p><strong>February</strong></p>
  
  <pre><code>01        02        03        04        ...        30
  101.1     233.43    1232.42  3232.21             121.23
  </code></pre>
  
  <p><strong>April</strong></p>
  
  <pre><code>01        02        03        04        ...        30        31
  11.1     23.43      122.42   332.21              121.23    2323.32
  </code></pre>
  
  <p>How could we perform this?</p>
  
  <p>Please give me a SQL as example.</p>
  
  <p>I thinking to write a method to discover the number of days of the month and than create the SQL iteratively, but I think this isn't the best way.</p>