title: Getting parent categories sum(price) formed in different tables
body: <p>I am trying to get the total prices of all parent categories in a specific month and year. A parent category is any category with a parent_id == 0. My query is like below:</p>
  
  <pre><code>SELECT
      ROUND(SUM(od.total_price)) as price, 
      c.parent_id as pId,
      c1.name
  FROM a_orders o 
      INNER JOIN a_order_details as od on o.id = od.order_id 
      INNER JOIN a_product as p on p.id = od.product_id 
      INNER JOIN a_category as c on c.id = p.category_id
      LEFT OUTER JOIN a_category c1 ON c.parent_id = c1.id
  WHERE YEAR(order_date) = 2018
      AND o.STAT = 'Y' 
      AND MONTH(order_date) = 6
  GROUP BY c.parent_id;
  </code></pre>
  
  <p>I'm getting parent categories just which have a price but I need to get all parent categories, if there is no price result should be 0.</p>
  
  <p>My sqlfiddle is -> <a href="http://sqlfiddle.com/#!9/b9f4c1/1" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/b9f4c1/1</a></p>
  
  <p>My result is like this :</p>
  
  <pre><code>price   pId  name
  410     1    T-SHIRT
  400     2    JEANS
  </code></pre>
  
  <p>But should be like this : </p>
  
  <pre><code>price   pId  name
  410     1    T-SHIRT
  400     2    JEANS
  0       6    SHOES
  </code></pre>