我发现模块化以后写的很快 with o as(select id,user_id,client_id,is_group_buy from ( select id,user_id,client_id,is_group_buy,count(id)over(partition by user_id) ding from order_info where product_name in('C++','Java','Python') and status = 'completed' and date>'2025-10-15') t1 where ding>=2 ) -------这部分前面的题通用 select source,count(source) cnt from (select if(is_group_buy='Yes','GroupBuy',name) source from o left join client c on o.client_id=c.id ) sou group by source order by source;