title: Getting all records but if some of them are connected then getting only last one
body: <p>example table</p>
  
  <pre><code>id | parentId | desc | date
  1  |   null   | .... |  1
  2  |   null   | .... |  2
  3  |    1     | .... |  3
  4  |    1     | .... |  4
  5  |    2     | .... |  5
  6  |   null   | .... |  6
  7  |   null   | .... |  7
  </code></pre>
  
  <p>okay, now I want to get all records BUT if some of them are connected via id &lt;-> parentId, then i want only the one with latest date. Result of the query for the table above shold be</p>
  
  <pre><code>id | parentId | desc | date
  4  |    1     | .... |  4
  5  |    2     | .... |  5
  6  |   null   | .... |  6
  7  |   null   | .... |  7
  </code></pre>
  
  <p>how can i do this in sqllite?</p>