select
b.user_id
,b.m
,a.date
,b.c
from (
select
*
,row_number() over(partition by user_id order by date) r
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')
order by user_id
) a # 将第二个时间放进去
right join (
select
user_id
,min(date) m
,count(user_id) c
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')
group by user_id
having count(user_id) >=2
order by user_id
) b #第四题的表格
on a.user_id =b.user_id
where a.r = 2
order by b.user_id