题解 | 每个商品的销售总额
select name as product_name, sum(quantity) as total_sales ,row_number()over(partition by category order by sum(quantity) desc) as category_rank from orders o left join products p on o.product_id=p.product_id where name is not null group by category,name order by category,total_sales desc
其实如果不运行一遍我根本不知道还需要加where name is not null。