title: SQl query to calculate number of active users at the end of everyday
body: <p>I have three columns <code>User_ID, New_Status and DATETIME</code>. </p>
  
  <p><code>New_Status</code> contains 0(inactive) and 1(active) for users. 
  Every user starts from active status - ie. 1. 
  Subsequently table stores their status and <code>datetime</code> at which they got activated/inactivated. </p>
  
  <p>How to calculate number of active users at the end of each date, including dates when no records were generated into the table.</p>
  
  <p>Sample data:</p>
  
  <pre><code>| ID | New_Status |      DATETIME       |
  +----+------------+---------------------+
  | 1  |      1     | 2019-01-01 21:00:00 |
  | 1  |      0     | 2019-02-05 17:00:00 |
  | 1  |      1     | 2019-03-06 18:00:00 |
  | 2  |      1     | 2019-01-02 01:00:00 |
  | 2  |      0     | 2019-02-03 13:00:00 |
  </code></pre>