[MySQL] 4 lines
\nSELECT p.product_id, ROUND(SUM(p.price*u.units)/SUM(u.units),2) AS average_price\nFROM Prices p, UnitsSold u\nWhere p.product_id = u.product_id and u.purchase
```\nSELECT p.product_id, ROUND(SUM(p.price*u.units)/SUM(u.units),2) AS average_price\nFROM Prices p, UnitsSold u\nWhere p.product_id = u.product_id and u.purchase_date BETWEEN p.start_date AND p.end_date\nGROUP BY p.product_id\n```
[]