题解 | #牛客的课程订单分析(六)#
牛客的课程订单分析(六)
https://www.nowcoder.com/practice/c5736983c322483e9f269dd23bdf2f6f
查询在2025-10-15以后,同一个用户下单2个以及2个以上状态为购买成功的C++课程或Java课程或Python课程的订单id,是否拼团以及客户端名字信息,最后一列如果是非拼团订单,则显示对应客户端名字,如果是拼团订单,则显示NULL,并且按照order_info的id升序排序 with o as(select id,user_id,client_id,is_group_buy from ( select id,user_id,client_id,is_group_buy,count(id)over(partition by user_id) ding from order_info where product_name in('C++','Java','Python') and status = 'completed' and date>'2025-10-15') t1 where ding>=2 ) select o.id,is_group_buy,if(is_group_buy='No',name,null) client_name from o left join client c on o.client_id=c.id order by o.id