题解 | 每个商品的销售总额

每个商品的销售总额

https://www.nowcoder.com/practice/6d796e885ee44a9cb599f47b16a02ea4

select t2.name AS product_name, sum(quantity) AS total_sales, row_number()over(partition by t2.category order by t2.category, sum(quantity) desc, t1.product_id) AS category_rank
  from orders t1
 inner join products t2
    on t1.product_id = t2.product_id
 group by t1.product_id, t2.name

全部评论

相关推荐

03-12 09:24
已编辑
复旦大学 C++
点赞 评论 收藏
分享
牛客28967172...:跟着卡子哥才是正道,灵茶属实不太行
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务