title: how to aggregate one record multiple times based on condition
body: <p>I have a bunch of records in the table below.</p>
  <pre><code>product_id       produced_date    expired_date
  123              2010-02-01       2012-05-31
  234              2013-03-01       2014-08-04
  345              2012-05-01       2018-02-25
  
  ...              ...             ...
  </code></pre>
  <p>I want the output to display how many unexpired products currently we have at the monthly level.  (Say, if a product expires on August 04, we still count it in August stock)</p>
  <pre><code>Month             n_products
  2010-02-01        10
  2010-03-01        12
  
  ...
  2022-07-01        25
  2022-08-01        15
  
  </code></pre>
  <p>How should I do this in Presto or Hive?  Thank you!</p>