title: SQL inner join sum
body: <p>I have 2 tables below. I want to join them and see the sums of c2 columns but the sum(table2.c2) result shows 18 instead of 9. How can I correct?</p>
  
  <p><strong>table1:</strong></p>
  
  <pre><code>c1 c2  
  a  6
  a  0
  </code></pre>
  
  <p><strong>table2</strong></p>
  
  <pre><code>c1  c2
  a   9
  </code></pre>
  
  
  
  <pre><code>select table1.c1 ,sum(table1.c2), table2.c1, sum(table2.c2)
  from table1
  inner join table2
  on table1.c1=table2.c1
  GROUP BY table1.c1 ,table2.c1
  </code></pre>
  
  <p>result is as follows:</p>
  
  <pre class="lang-none prettyprint-override"><code>table1.c1   sum(table1.c2)  table2.c1   sum(table2.c2)
  a           6               a           18
  </code></pre>
  
  <p>I expect like that:</p>
  
  <pre class="lang-none prettyprint-override"><code>table1.c1   sum(table1.c2)  table2.c1   sum(table2.c2)
  a           6               a           9
  </code></pre>