title: Consolidate multiple rows of data into one
body: <p>I have the following data that needs to be consolidated:</p>
  
  <pre><code>+---------------------------------------------------------------------------------+
  | eventid    username   loginstart          loginend            data1 data2 data3 |
  +---------------------------------------------------------------------------------+
  | 1234       abc        2013-11-04 02:22:22  2013-11-04 02:32:22   2     4     0  |
  | 1239       abc        2013-11-04 02:22:22  2013-11-04 02:32:22   1     0     0  |
  | 1232       cdf        2013-11-04 02:22:22  2013-11-04 02:32:22   2     4     0  |
  +---------------------------------------------------------------------------------+
  </code></pre>
  
  <p>what i need is the output to look like the following:</p>
  
  <pre><code>+------------------------------------------------------------------------+
  | username   loginstart           loginend             data1 data2 data3 |
  +------------------------------------------------------------------------+
  | abc        2013-11-04 02:22:22  2013-11-04 02:32:22   3     4     0    |
  | cdf        2013-11-04 02:22:22  2013-11-04 02:32:22   2     4     0    |
  +------------------------------------------------------------------------+
  </code></pre>
  
  <p>Basically what the output has done is match the event that happend within the loginstart and loginend of that user and added the data up to give a single row.</p>
  
  <p>Any tips would be welcome on achieve the desired output.</p>