题解 | #牛客的课程订单分析(七)#

牛客的课程订单分析(七)

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






with new as
(
select
*
,count(status)over(partition by user_id) as cnt
from order_info
where date>'2025-10-15' and status='completed' and product_name in('C++','Java','Python')
)
, new1 as
(
select
*
from new
where cnt>=2
)
, new2 as
(
select
coalesce(c.name,'GroupBuy') as source #这样只是将NULL换作group by而已
#,cnt 这个cnt是一个用户有多少订单,不符合题目要求的这个客户端有多少订单
from new1 n left join client c
on n.client_id = c.id
)

select
source
,count(*)
from new2
group by source
order by source asc

全部评论

相关推荐

asdasdasdasdas:19岁,不容易啊可能升个本会好点,现在学历歧视太严重了
点赞 评论 收藏
分享
Rena1ssance_:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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