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

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

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

select case when c.name is not null then c.name else 'GroupBuy' end as source,
count(*) as cnt
from(select id,client_id,is_group_buy,count(*)over(partition by user_id) as rn
from order_info
where status='completed' and date>'2025-10-15'
and product_name in('C++','Java','Python'))sub
left join client c on sub.client_id=c.id
where sub.rn>=2
group by c.name
order by source

错误:case when sub.is_group_buy='No' then c.name else NULL end as client_name

借用这个表达,这样group by中无法组合

全部评论

相关推荐

zaakfung:26届不应该春招吗 为啥还实习
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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