1 先筛选出符合时间、购买成功、课程要求的行, 2 对user_id分组,聚合函数统计各id的最小时间和购买次数, 3 having筛选出购买2次及以上的id
select user_id,min(date) first_buy_date,count(id) cnt
from order_info
where date>='2025-10-15'
and status='completed'
and product_name in ('C++','Python','Java')
group by user_id
having cnt>=2
order by user_id;