title: Sqlite group by date get latest row value for that date
body: <p>Let's take for example this select:</p>
  
  <pre><code>Select date, sum(field1), max(field2)
   from table
  group by date
  order by date
  </code></pre>
  
  <p>Let's also say that in my table for each date I have 2-3 rows, so:</p>
  
  <pre><code>|   date   | field1 | field2  | 
  -------------------------------
  |01-01-2017| 4      | 34      |
  |01-01-2017| 5      | 37      |
  |01-01-2017| 3      | 33      |
  |01-02-2017| 15     | 41      |
  |01-02-2017| 13     | 39      |
  </code></pre>
  
  <p>My above select will return</p>
  
  <pre><code>|   date   | field1 | field2  | 
  |01-01-2017| 12     | 37      |
  |01-02-2017| 28     | 41      |
  </code></pre>
  
  <p>I want that for each date to obtain for field2 the last inserted value, so
  33 for first date and 39 for the second one. </p>
  
  <p>Any simple way of obtaining my result? Would simply removing the <code>max</code> for field2 work and the query would take the last value? 
  I am using Sqlite on android if it matters.</p>
  
  <p>LE: table also has id auto increment field as primary key.</p>