with
t1 as(
select
oi.id as id,
user_id,
count(user_id)over(partition by user_id) as course_cnt,
product_name,
(case
when name is null then 'GroupBuy'
else name
end) as name,
date,
is_group_buy as igb
from
order_info as oi left join client as c on oi.client_id=c.id
where
date>'2025-10-15'
and
status='completed'
and
product_name in ('C++','Java','Python')
),
t2 as(
select
name as source,
count(*)
from
t1
where
course_cnt>=2
group by
source
order by
source
)
select * from t2

京公网安备 11010502036488号