Very Easy solution🔥🔥
\n# Code\nmysql []\n# Write your MySQL query statement below\n\nSELECT Prices.product_id,IFNULL(ROUND(SUM(Prices.price*UnitsSold.units)/SUM(UnitsSold.units),2),
\n# Code\n```mysql []\n# Write your MySQL query statement below\n\nSELECT Prices.product_id,IFNULL(ROUND(SUM(Prices.price*UnitsSold.units)/SUM(UnitsSold.units),2),0) AS average_price\nFROM Prices LEFT JOIN UnitsSold\nON Prices.product_id = UnitsSold.product_id \nAND purchase_date BETWEEN start_date AND end_date\nGROUP BY product_id;\n\n-- # Write your MySQL query statement below\n-- SELECT p.product_id, IFNULL(ROUND(SUM(units*price)/SUM(units),2),0) AS average_price\n-- FROM Prices p LEFT JOIN UnitsSold u\n-- ON p.product_id = u.product_id AND\n-- u.purchase_date BETWEEN start_date AND end_date\n-- group by product_id\n```\n\n![UPVOTE.jpeg](https://assets.leetcode.com/users/images/dbbc9375-cf4f-409e-bdf5-e900fcaa2cbc_1726921900.152092.jpeg)\n
['MySQL']