nishita_1 15 Newbie Poster

DEAR AndrisP, Thanks for your reply. i am already solve this problem using below code.

SELECT I.product_id, 
       COALESCE(S.sale, 0) AS sale, 
       COALESCE(P.purchase, 0) AS purchase
FROM Product I
LEFT JOIN (
    SELECT product_id, SUM(quantity) AS sale
    FROM order_item 
    GROUP BY product_id
) S ON S.product_id = I.product_id
LEFT JOIN (
    SELECT product_id, SUM(quantity) AS purchase
    FROM pur_item
    GROUP BY product_id
) P ON P.product_id = I.product_id

Dear sir, AndrisP Thanks a lot. you are very helpfully person and your code is perfect. Sir can you tell me, if i want to total sum of sale and purchase date wise. then what code needed. i am already made another table which content date. Thank you

nishita_1 15 Newbie Poster

please any one help me

pritaeas commented: If you need more help, explain what's wrong with my solution. +15