title: Sum entries of an sqlite query
body: <p>I have a table similar to this:</p>
  
  <pre><code>| id(INTEGER) | id2(INTEGER) |    time(DATETIME)    | value(REAL) |
  |-------------|--------------|----------------------|-------------|
  |     1       |      2000    |  2004-01-01 00:00:00 |    1000     |
  </code></pre>
  
  <p>which I query with visual basic. Now I want to sum all entries between year 2004 and 2010 so the result looks like this:</p>
  
  <pre><code>2004 11,000
  2005 35,000
  2006 46,000
  </code></pre>
  
  <p>cIf I do it inside visual basis it is achieved with few loops but unfortunately this is not very performant.</p>
  
  <p>Is it possible to create a query which yields the result say between two years grouped by years. Or between two months (within one year), grouped by months, days (within one month), hours (within one day), minutes (within one hour)?</p>
  
  <p>EDIT:
  Query for year interval:</p>
  
  <pre><code>SELECT STRFTIME('%Y', time) AS year, SUM(value) AS cumsum FROM mytable WHERE year &gt;= STRFTIME('%Y','2005-01-01 00:00:00') AND year &lt;= STRFTIME('%Y','2010-01-01 00:00:00') GROUP BY STRFTIME('%Y', mytable.time)  ORDER BY year;
  </code></pre>
  
  <p>Now need an idea for months, days and hours.</p>