We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6d10b6 commit e01c946Copy full SHA for e01c946
BASIC AGGREGATION FUNCTION/1251. Average Selling Price.sql
@@ -0,0 +1,6 @@
1
+# Write your MySQL query statement below
2
+SELECT p.product_id, IFNULL(ROUND(SUM(units*price)/SUM(units),2),0) AS average_price
3
+FROM Prices p LEFT JOIN UnitsSold u
4
+ON p.product_id = u.product_id AND
5
+u.purchase_date BETWEEN start_date AND end_date
6
+group by product_id
0 commit comments