select
case when c.name is null then 'GroupBuy'
when c.name is not null then c.name
end as source,
count(*) as cnt
from
(select
*,
count(*) over(partition by user_id) as counts
from
order_info
where
date > '2025-10-15' and status = 'completed' and product_name in ('C++','Java','Python')) a
left outer join
client as c
on
a.client_id = c.id
where
a.counts >= 2
group by
source
order by
source

京公网安备 11010502036488号