题解 | 电商平台想要查询出每个商品在 2024 年上半年(1 月至 6 月)的总销售额

电商平台想要查询出每个商品在 2024 年上半年(1 月至 6 月)的总销售额

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

select p.product_id ,product_name , sum(quantity*price) total_sales
from products_underline p
left join (
select product_id,sum(quantity) quantity
from sales_underline
where sale_month between '2024-01' and '2024-06'
group by 1 )c
on p.product_id = c.product_id
group by 1,2

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 15:58
投个小米提前批试试水,先投一个岗位看看形势,不行就再沉淀一下投第二个岗位,莫辜负
Java抽象带篮子:我嘞个骚刚,已经开始研发6g了吗
投递小米集团等公司7个岗位
点赞 评论 收藏
分享
07-10 12:17
已编辑
商丘师范学院 Java
后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
无实习如何秋招上岸
点赞 评论 收藏
分享
06-24 19:27
云南大学 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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