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

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

http://www.nowcoder.com/questionTerminal/4ca4137cb490420cad06d2147ae67456

select * from order_info where date>'2025-10-15' and status='completed' and product_name in('C++','Java','Python')
但是要求同一个用户下单2个以及2个以上状态为购买成功,那么最好是按user_id分组,然后通过having count(user_id)>1去判断是不是超过2个订单,最后按照user_id升序,可以写出如下:
select user_id from order_info where date>'2025-10-15' and status='completed' and product_name in('C++','Java','Python')
group by user_id having count(user_id)>1 order by user_id



全部评论

相关推荐

10-16 15:48
算法工程师
点赞 评论 收藏
分享
评论
11
1
分享

创作者周榜

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