left join容易出错,注意client表里是没有GroupBy这个name的

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