title: Mysql left/inner join combination not working as expected
body: <p>I am trying to list product variations with their quantities ordered, BUT ALSO show the product variations where there is no quantity ordered. So I thought it would be as simple as selecting the products and doing a left join on the orders of each product where the order is a current revision. </p>
  
  <p>So I expected like this order of operations:</p>
  
  <pre><code>SELECT p.product_id, SUM(po.quantity) 
  FROM `products` p 
  LEFT JOIN `product_orders` po ON p.product_id=po.product_id 
  LEFT JOIN `orders` o ON o.order_id=po.order_id AND o.is_current='1'
  </code></pre>
  
  <p>but that is getting also the quantities where the is_current is not 1
  Then I thought, okay, I can just do an inner join after the left join instead like this:</p>
  
  <pre><code>SELECT p.product_id, SUM(po.quantity) 
  FROM `products` p 
  LEFT JOIN `product_orders` po ON p.product_id=po.product_id 
  INNER JOIN `orders` o ON o.order_id=po.order_id AND o.is_current='1'
  </code></pre>
  
  <p>but then the products which have not been ordered yet are not being listed. I expected them to to show up as SUM(quantity) being NULL.
  Can anyone see where my logic has gone wrong?
  Thanks!
  Scott</p>