title: Analytics in sql
body: <p>I have a table with the following structure:
        <code>use_id (int) - event (str) - time (timestamp) - value (int)</code></p>
  
  <p>Event can take several values : install, login, buy, etc.</p>
  
  <p>I need to get all user records before updating the application. 
  For example moment of release of my application - 1 January 2019, but users may be install new version on any day. </p>
  
  <p>How can i get <code>sum(value)</code> by the first and second versions. ---------</p>
  
  <p>I tried self-join table, but I think that this is not the best solution.</p>
  
  <p>Help me, please.</p>