写的有点复杂...
和78做法类似,但是要列出所有的信息,不能使用group by
先来看条件:
#在2025-10-15以后
#同一个用户下单2个以及2个以上
#状态为购买成功
#C++课程或Java课程或Python课程
#按照order_info的id升序排序
select o.id, o.user_id, o.product_name, o.status, o.client_id, o.date from order_info o join (select id, user_id, product_name, status, client_id, date from order_info where date > '2025-10-15' and status = 'completed' and product_name in ('C++','Java','Python') group by user_id having count(id) > 1)a on a.user_id = o.user_id where o.date > '2025-10-15' and o.status = 'completed' and o.product_name in ('C++','Java','Python') order by o.id asc;