title: Create dynamic SQL statement for one year
body: <p>I would like to compare the number of newly made subscriptions with the number of ending subscriptions per month in 2018 and combine that into one table.</p>
  
  <p>With x-axis being the months of 2018 (so January, February, and so on) and y-axis as first row my first sql query = the number of ran out subscriptions in that month. The second row would be my second sql query = the number of newly made subscriptions in that month. My "queries" down there are as an example for March 2018.</p>
  
  <pre><code>SELECT    
      COUNT (UserId)
  FROM
      UserInAppPurchase 
  WHERE 
      ValidTo &gt; '2018-03-01' AND ValidTo &lt; '2018-03-31' 
  GROUP BY
      UserId
  
  SELECT COUNT(UserId)
  FROM UserInAppPurchase 
  WHERE PurchaseDate &gt; '2018-03-01' 
    AND PurchaseDate &lt; '2018-03-31' 
  GROUP BY UserId
  </code></pre>
  
  <p>Thanks very much for the help</p>