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

每个商品的销售总额

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

select   a.name product_name,sum(b.quantity) total_sales, rank()over(partition by a.category order by sum(b.quantity) desc) category_rank from products a
join orders b ON a.product_id=b.product_id
group by a.product_id,a.name 
order by a.category,total_sales desc

全部评论

相关推荐

01-30 09:45
燕山大学 Java
喵_coding:这种直接跑就完事了 哪有毕业了才签合同 任何offer和三方都没有的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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