diff --git a/README.md b/README.md index 608c120..19a0904 100644 --- a/README.md +++ b/README.md @@ -161,14 +161,17 @@ ORDER BY rating DESC [1251. Average Selling Price](https://leetcode.com/problems/average-selling-price/) ```sql --- avg(selling), round 2 SELECT p.product_id, - ROUND(SUM(price * units) / SUM(units), 2) AS average_price + ROUND( + IFNULL(SUM(price * units) / SUM(units), 0), + 2 + ) AS average_price FROM Prices p LEFT JOIN UnitsSold s ON p.product_id = s.product_id AND purchase_date BETWEEN start_date AND end_date -GROUP BY p.product_id +GROUP BY p.product_id; + ``` [1075. Project Employees I](https://leetcode.com/problems/project-employees-i)