Skip to content

Commit 3c19da7

Browse files
Update Average_Selling_Price.sql
1 parent d89415b commit 3c19da7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
select p.product_id ,Coalesce(round(sum(p.price * u.units) / sum(u.units),2),0) as average_price from prices p left join unitssold u
22
on p.product_id = u.product_id and u.purchase_date between p.start_date and p.end_date
33
group by p.product_id;
4+
5+
6+
7+
--Rakshit Gupta

0 commit comments

Comments
 (0)