title: Mysql Sum up to each day of the month
body: <p>Get sum up to each day of the month</p>
  
  <p>Here is my table called payment</p>
  
  <pre><code>amount  | date_added
  ===================================
  30.00           |2016-12-05 20:48:13
  -10             |2016-12-10 17:39:45
  -55.30          |2016-12-10 17:55:18
  78.00           |2016-12-11 14:50:50
  -20.00          |2016-12-11 15:50:50
  -30.00          |2016-12-22 01:47:22
  300.00          |2016-12-23 01:01:36
  -40             |2016-12-24 02:10:00
  </code></pre>
  
  <p>I tried the following query on it but it gives sum of each day.</p>
  
  <pre><code>SELECT SUM(`amount`) as total_amount, `date_added`  FROM `payment` where (`payment`.`date_added` between '2016-12-1'  and '2016-12-30') GROUP BY  DATE(date_added)
  </code></pre>
  
  <p>The result was </p>
  
  <pre><code>total_amount    | date_added
  ===================================
  30.00       |2016-12-05 20:48:13
  -65.30      |2016-12-10 17:39:45
  58.00       |2016-12-11 14:50:50
  -30.00      |2016-12-22 01:47:22
  300.00      |2016-12-23 01:01:36
  -40.00      |2016-12-24 02:10:00
  </code></pre>
  
  <p>What I want is <strong>sum up to the each day of the month</strong>. NOT the sum of each day. </p>
  
  <p><strong>I want the following result with Mysql.</strong></p>
  
  <pre><code>total_amount    | date_added
  ===================================
  30.00       |2016-12-05 20:48:13
  -35.30      |2016-12-10 17:39:45
  22.70       |2016-12-11 14:50:50
  -7.30       |2016-12-22 01:47:22
  292.70      |2016-12-23 01:01:36
  252.70      |2016-12-24 02:10:00
  </code></pre>