title: SQL - Cumulative sum in sql, base on continuous dates
body: <p>Suppose I have a table with data as below:</p>
  
  <pre><code>SELECT *
  FROM TestTable
  ORDER BY deliver_date
  
  deliver_date    quantity
  2015-10-01  5.00
  2015-10-02  3.00
  2015-10-05  10.00
  2015-10-07  8.00
  2015-10-08  6.00
  </code></pre>
  
  <p>I know how to do the cumulative as below:</p>
  
  <pre><code>SELECT t1.deliver_date, SUM(t2.quantity) AS cumQTY 
  FROM TestTable t1 
  INNER JOIN TestTable t2 ON t2.deliver_date &lt;= t1.deliver_date 
  GROUP BY t1.deliver_date
  ORDER BY t1.deliver_date
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>deliver_date    cumQTY
  2015-10-01  5.00
  2015-10-02  8.00
  2015-10-05  18.00
  2015-10-07  26.00
  2015-10-08  32.00
  </code></pre>
  
  <p>But, is it possible for me to get the result as below?</p>
  
  <pre><code>deliver_date    cumQTY
  2015-10-01  5.00
  2015-10-02  8.00
  2015-10-03  8.00
  2015-10-04  8.00
  2015-10-05  18.00
  2015-10-06  18.00
  2015-10-07  26.00
  2015-10-08  32.00
  </code></pre>
  
  <p>Means, the date must follow continuously.
  For example: I do not have 2015-10-03 data in my TestTable table, but the cumulative table must show the date 2015-10-03</p>
  
  <p>Appreciate if someone can help on this.
  Thank you.</p>