Dashboard Temp Share Shortlinks Frames API

HTMLify

Day 40
Views: 2 | Author: djdj
1
2
3
4
5
6
7
8
9
# Write your MySQL query statement below
select 
  p.product_id,
  round(coalesce(sum(p.price * u.units) / sum(u.units),0), 2) as average_price
from Prices p
left join UnitsSold u
  on p.product_id = u.product_id
 and u.purchase_date between p.start_date and p.end_date
group by p.product_id;