题解 | 每个商品的销售总额
select a.name product_name, a.total_sales, rank() over ( partition by a.category order by total_sales desc ) category_rank from ( select name, category, sum(quantity) total_sales from test.products pr join test.orders ord on pr.product_id = ord.product_id group by name, category ) a