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

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

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

自己还是比较习惯这种窗口函数的写法


select t.id ,t.is_group_buy,
case when is_group_buy = 'No' then t.client_name else NULL end 
from (select tmp.*,
sum(case when status='completed' then 1 else 0 end) over(partition by user_id) as cnt 
from (select a.* , b.name as client_name from order_info a left join 
client b on a.client_id = b.id ) tmp
where status = 'completed' and date > '2025-10-15' and product_name in ('C++','Java','Python')

) t where t.cnt >= 2 order by id asc







全部评论

相关推荐

08-04 22:37
桂林学院 Java
行不行阿细GO:说真的我现在看到校招java简历都头痛。。千篇一律和阅卷高考作文差不多,估计公司也是吧,到最后就看学历和大厂实习了
投递BOSS直聘等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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