题解 | 每个商品的销售总额
每个商品的销售总额
https://www.nowcoder.com/practice/6d796e885ee44a9cb599f47b16a02ea4
select
name as product_name,
sum(quantity) as total_sales,
dense_rank() over(partition by category order by category asc, sum(quantity) desc, product_id asc) as category_rank
from orders
join products using (product_id)
group by name, category, product_id