题目:
编写一个 SQL 查询,按产品 id product_id 来统计每个产品的销售总量。
查询结果格式如下面例子所示:
解题思路:
没有用到product表,直接在sales表中使用聚合函数:
1 select product_id,sum(quantity) as total_quantity 2 from sales 3 group by product_id;标签:1069,product,sales,力扣,MySQL,id From: https://www.cnblogs.com/liu-myu/p/17297944.html