select b.id, is_group_buy, 
(case when is_group_buy = 'Yes' then 'None'
	 when is_group_buy ='No' then name end) as client
from client
right outer join
(select id, client_id, count(1) over (partition by user_id) as cnt, is_group_buy
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')) as b
on client.id = b.client_id
where cnt >= 2
order by b.id;

这几道题都是技巧类,掌握窗口函数,的确可以省下很多的麻烦事。