leetcode 1251 平均售價
leetcode 1251 平均售價
select r.product_id, round(sum(r.price * r.units) / sum(r.units), 2) as average_price from ( select p.product_id, p.price , u.units from Prices p left join UnitsSold u on p.product_id = u.product_id where u.purchase_date between p.start_date and p.end_date ) r group by r.product_id
==

浙公网安备 33010602011771号