题解 | 分析每个商品在不同时间段的销售情况

分析每个商品在不同时间段的销售情况

https://www.nowcoder.com/practice/eec7a93e1ab24233bd244e04e910d2f9

select 
    product_id,product_name,
    sum(coalesce(total_amount,0))  q2_2024_sales_total,
    rank() OVER(PARTITION BY category order by COALESCE(sum(total_amount),0) desc) category_rank,
    supplier_name
FROM
    product_info s1
left JOIN
    (select * FROM order_info where date_format(order_date,'%y%m') between 2404 and 2406) s2
using(product_id)
left JOIN
    supplier_info s3
using(product_id)
group by 1,2,category,5
order by 1

全部评论

相关推荐

秋招投简历提醒助手:个人经验是,一般面二十场左右就会进入侃侃而谈阶段。我今年七月末的时候开始的第一次面试,都是很多不会,回复很慢。后面慢慢迭代,到九月中的时候基本上面啥说啥,很放松的状态
远程面试的尴尬瞬间
点赞 评论 收藏
分享
2025-12-22 16:31
已编辑
桂林电子科技大学 Python
很奥的前端仔:如果你接了offer 临时又说不去 hr确实要多做一些工作。 当然如果是接offer之前当我没说
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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