title: Calculate sum of decimals from separate tables for each year with latest entry
body: <p>How to get the sum of decimals from two tables.
  Table A is holding only the current year value (per A.ID) and table B is holding the changes of the table A object including previous changes for the current year.</p>
  
  <pre><code>Table A:
  "ID"     &gt;&gt; int (PrimaryKey), 
  "Date"   &gt;&gt; datetime,
  "AValue" &gt;&gt; decimal 
  
  Objects of A:
  1 | 12/02/2018 | 10.000
  2 | 11/25/2018 | 20.000
  
  Table B:
  "ID"       &gt;&gt; int (PrimaryKey), 
  "AObjID"   &gt;&gt; int (ForeignKey to Table A.ID), 
  "Date"     &gt;&gt; datetime, 
  "BValue"   &gt;&gt; decimal
  
  Objects of B:
   1 | 1 | 08/06/2018 | 9.000 
   2 | 1 | 12/15/2017 | 10.000  *
   3 | 1 | 10/18/2017 | 8.000
   4 | 1 | 12/09/2016 | 10.000 *
   5 | 1 | 11/11/2016 | 5.000
   6 | 2 | 05/21/2018 | 13.000 
   7 | 2 | 12/19/2017 | 20.000 **
   8 | 2 | 08/04/2017 | 15.000 
   9 | 2 | 05/13/2017 | 15.000
  10 | 2 | 12/25/2016 | 20.000 **
  11 | 2 | 02/21/2016 | 15.000
  12 | 2 | 11/09/2015 | 20.000 **
  </code></pre>
  
  <p>The result should sum together the current year AValue and all related BValues, where the latest entry of every year should be taken, except the current Year of A.</p>
  
  <p>Case A.ID = 1 >> (Result = 30.000):</p>
  
  <pre><code> A:      1 | 12/02/2018 | 10.000
   B:  2 | 1 | 12/15/2017 | 10.000 *
   B:  4 | 1 | 12/09/2016 | 10.000 *
  </code></pre>
  
  <p>Case A.ID = 2 >> (Result = 80.000):</p>
  
  <pre><code> A:       2 | 11/25/2018 | 20.000
   B:   7 | 2 | 12/19/2017 | 20.000 **
   B:  10 | 2 | 12/25/2016 | 20.000 **
   B:  12 | 2 | 11/09/2015 | 20.000 **
  </code></pre>
  
  <p>Still struggling with this ... Any help appreciated! Thank you guys.</p>