mysql无敌套中套:
select (case when a.is_group_buy = 'yes' then 'GroupBuy'else c.name end) t,
count(case when a.is_group_buy = 'yes' then 'GroupBuy'else c.name end) s
from order_info a
join
(select user_id from order_info
where date > '2025-10-15'
and product_name in ('C++','Java','Python')
and status = 'completed'
group by user_id
having count(user_id) >= 2
) b on a.user_id = b.user_id
left join client c on a.client_id = c.id
where a.date > '2025-10-15'
and a.product_name in ('C++','Java','Python')
and a.status = 'completed'
group by case when a.is_group_buy = 'yes' then 'GroupBuy'else c.name end
order by case when a.is_group_buy = 'yes' then 'GroupBuy'else c.name end asc