title: Getting the sum of several columns from two tables
body: <p>I want to get the sum of several columns from 2 different tables (these tables share the same structure).</p>
  
  <p>If I only consider one table, I would write this kind of query:</p>
  
  <pre><code>SELECT MONTH_REF, SUM(amount1), SUM(amount2)
      FROM T_FOO
      WHERE seller = XXX
      GROUP BY MONTH_REF;
  </code></pre>
  
  <p>However, I would like to also work with the data from the table T_BAR, and then have a <code>select</code> query that return the following columns:</p>
  
  <ul>
  <li>MONTH_REF</li>
  <li>SUM(T_FOO.amount1) + SUM(T_BAR.amount1)</li>
  <li>SUM(T_FOO.amount2) + SUM(T_BAR.amount2)</li>
  </ul>
  
  <p>everything grouped by the value of <code>MONTH_REF</code>.</p>
  
  <p>Note that a record for a given <code>MONTH_REF</code> can be found in one table but not in the other table.
  In this case, I would like to get the sum of <code>T_FOO.amount1 + 0</code> (or <code>0 + T_BAR.amount1</code>).</p>
  
  <p>How can I write my SQL query to get this information?</p>
  
  <p>For information, my database is Oracle 10g.</p>