title: Calculating a conditional cumulative sum in Oracle
body: <p>The broad view of what I'm trying to do is find out how many reservations that have not yet happened yet are on the books in the entire system, by the date that the reservation was booked. This means counting the number of all records that exist with a <code>redemption_date</code> after or equal to <code>booking_date</code>, grouping by <code>booking_date</code>. Please see the following hypothetical example for a better explanation:  </p>
  
  <pre><code>redemption_date      booking_date
  2013-01-01           2013-01-01
  2013-01-06           2013-01-01
  2013-01-06           2013-01-01
  2013-01-07           2013-01-02
  2013-01-08           2013-01-03
  2013-01-09           2013-01-04
  2013-01-10           2013-01-05
  2013-01-10           2013-01-05
  2013-01-10           2013-01-05
  2013-01-10           2013-01-05
  2013-01-10           2013-01-05
  2013-01-11           2013-01-05
  </code></pre>
  
  <p>I would like the result:</p>
  
  <pre><code>booking_date         number_of_reservations
  2013-01-01           3
  2013-01-02           3
  2013-01-03           4
  2013-01-04           5
  2013-01-05           11
  </code></pre>
  
  <p>But my brain is completely failing me as to how the query should be structured. Any tips? Thanks!</p>
  
  <p>Edit:
  To clarify, number_of_reservations should be the number of reservations that were booked on that date, as well as those booked on days AFTER that. In other words, number_of_reservations is the number of reservations that are in the database as of booking_date (that have not yet happened).
  My original results did have mistakes. Sorry for the confusion</p>