title: MYSQL LEFT JOIN BRINGS WRONG RESULTS
body: <p>I am trying to figure out why the join brings back the results it does.</p>
  
  <p>Here is a simple test im working on.</p>
  
  <p>I have two tables : Table1 and Table2.</p>
  
  <p>table1</p>
  
  <pre><code>-------------------
  id    name      amount
  ---------------------
  1   | Fred      | 2
  3   | Fred      | 3
  5   | Fred      | 4
  2   | Hellen    | 3
  4   | Hellen    | 3
  6   | Hellen    | 3
  </code></pre>
  
  <p>table2</p>
  
  <pre><code>-------------------
  id    name      amount
  ---------------------
  1   | Fred      |4
  2   | Hellen    |3
  3   | Paul      |3
  4   | Fridah    |5
  </code></pre>
  
  <p>When i use the following statement</p>
  
  <pre><code>SELECT p.name,sum(p.amount) as amount FROM `table1` as p  
  left join table2 as c on p.name = c.name GROUP BY c.name , p.name
  </code></pre>
  
  <p>I get this result</p>
  
  <pre><code>---------------
  name    amount
  ---------------     
  Fridah  | 5
  Paul    | 3
  Fred    | 12
  Hellen  | 9
  </code></pre>
  
  <p>But this is really wierd. I want the sum of <code>amount</code> from just table1, b ut the join gives me a sum of both tables. Why is this? </p>