select user_id,substring_index(GROUP_CONCAT(date ORDER BY date ),',',1) first_buy_date,
substring_index(substring_index(GROUP_CONCAT(date ORDER BY date ),',',2),',',-1) second_buy_date,
count() cnt
from (
select user_id,date
from order_info
where date>='2025-10-15' and status='completed'
and product_name in ('C++','Java','Python')
) aa group by user_id having count(
)>=2 order by user_id ;