题解 | 分析每个商品在不同时间段的销售情况
分析每个商品在不同时间段的销售情况
https://www.nowcoder.com/practice/eec7a93e1ab24233bd244e04e910d2f9
select a.product_id, b.product_name, sum(case when a.order_date between '2024-04-01' and '2024-06-30' then a.total_amount else 0 end) as q2_2024_sales_total, row_number() over(partition by b.category order by sum(case when a.order_date between '2024-04-01' and '2024-06-30' then a.total_amount else 0 end) desc) as category_rank, c.supplier_name from order_info a left join product_info b on a.product_id=b.product_id left join supplier_info c on a.product_id=c.product_id group by a.product_id,b.product_name,c.supplier_name order by a.product_id
OPPO公司福利 1225人发布
查看17道真题和解析