title: how to get SUM from two different tables that are linked to third one
body: <p>ok the problem is that I have to sum two sums from two tables that are linked</p>
  
  <p>first table points:</p>
  
  <pre><code>id | user_id | point | hit
  1  | 1       |     4 | yes
  2  | 1       |     2 | yes
  3  | 1       |    -3 | no
  4  | 1       |     4 | mb
  5  | 2       |     2 | yes
  6  | 2       |    -3 | no
  7  | 2       |     4 | mb
  </code></pre>
  
  <p>seccond table earnings:</p>
  
  <pre><code>id | user_id | earning
  1  | 1       |   5      
  2  | 1       |   2     
  3  | 1       |   3     
  4  | 1       |   4     
  5  | 2       |   2    
  6  | 2       |   3    
  7  | 2       |   4  
  </code></pre>
  
  <p>now what I've tried is this:</p>
  
  <pre><code>SELECT 
      p.id, 
      SUM( SUM(p.point) + SUM(e.earning) ) AS bb 
  FROM 
      points p LEFT JOIN earnings e ON p.user_id = e.user_id 
  WHERE 
      (p.hit = "yes" OR p.hit = "no") 
  GROUP BY 
      p.user_id
  </code></pre>
  
  <p>but I got wrong results</p>
  
  <p>I want to get this:</p>
  
  <pre><code>id | bb
  1  | 17
  2  | 8
  </code></pre>
  
  <p>Thanks!</p>