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


京公网安备 11010502036488号