select user_id,min(date)over(partition by user_id) first_buy_date,
d2 second_buy_date,
cnt
from (select ,lead(date,1)over(partition by user_id order by date) d2,
count()over(partition by user_id) cnt
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Java','Python')) a
where cnt >= 2
group by user_id
order by user_id;