select
t3.user_id,
min(t3.date) as first_buy_date,
count(id) as cnt
from
(select
t1.*
from
order_info t1
inner join
(select user_id
from order_info
where
status='completed'
and product_name in('C++','Java','Python')
and date>'2025-10-15'
group by user_id
having count(id)>=2) t2
on
t1.user_id=t2.user_id
where
status='completed'
and product_name in('C++','Java','Python')
and date>'2025-10-15')t3
group by t3.user_id
order by t3.user_id



京公网安备 11010502036488号