思路:先聚合、再排序错误点:group by 后的字段必须在select里 with tmp as ( select o.product_id , p.category , p.name as product_name , sum(o.quantity) as total_sales from products p join orders o on p.product_id = o.product_id group by o.product_id, p.name, p.category ) select product_name , total_sales , row_number() ove...