题目链接:点击打开链接
题目大意:略。
解题思路:略。
AC 代码
SELECT name, IFNULL(SUM(rest), 0) rest, IFNULL(SUM(paid), 0) paid, IFNULL(SUM(canceled), 0) canceled, IFNULL(SUM(refunded), 0) refunded FROM Invoice i RIGHT JOIN Product p USING(product_id) GROUP BY product_id ORDER BY name