title: Avoid cartesian product in three tables using LEFT join
body: <p>I have following 3 tables:-</p>
  
  <ol>
  <li>customers (customer_id, name)</li>
  <li>achived (achived_id, customer_id, achieved)</li>
  <li>target (target_id, customer_id, target)</li>
  </ol>
  
  <p>On writing the following query, I am getting wrong output due to cartesian product:-</p>
  
  <pre><code>SELECT C.name customer, SUM(A.achieved) achived, SUM(T.target) target
  FROM customers C
  LEFT JOIN achieved A
  ON C.customer_id = A.customer_id
  LEFT JOIN target T
  ON C.customer_id = T.customer_id 
  GROUP BY customer
  </code></pre>
  
  <p>What would be the right approach of getting correct result using LEFT join?</p>