第二列显示这个客户端(或者是拼团订单)有多少订单——分组计数!
select (case when is_group_buy = 'Yes' then 'GroupBuy' else b.name end) as source, count(*) cnt from (select *, count(*) over(partition by user_id) as n from order_info where date > '2025-10-15' and product_name in ('C++','Java','Python') and status = 'completed') a left join client b on a.client_id = b.id where n > 1 group by source order by source asc;