You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select p.product_id, ifnull(round(sum(u.units *p.price) / sum(u.units), 2), 0) as average_price from Prices as p left join UnitsSold as u on u.product_id = p.product_id and u.purchase_date between p.start_date and p.end_date group by p.product_id;