title: Get the sum of a list of integer values
body: <p>I'm looking to obtain the sum of a results column. The query is:</p>
  
  <pre><code>SELECT  T1.state,
          CAST ((JulianDay(T2.created) - JulianDay(T1.created)) * 24 * 60 * 60 As Integer) AS Interval
  FROM    states T1
          INNER JOIN states T2
              ON T1.entity_id = T2.entity_id
              AND T2.created &gt; T1.created
              AND T2.state = "off"
  WHERE T1.entity_id = "switch.panel_oficina"
  AND T1.state = "on"
  AND date(T1.created) = date('now')
  GROUP BY T1.entity_id, T1.state, T1.created 
  LIMIT 5;
  </code></pre>
  
  <p>This returns</p>
  
  <pre><code>state   Interval
  on  13421
  on  900
  on  1380
  on  839
  on  659
  </code></pre>
  
  <p>So, what I need is the sum of the column "Interval" (in this case 17199)</p>
  
  <p>TIA</p>