select id,is_group_buy,if(is_group_buy='yes',null,client_name) client_name from
(select o.id,o.client_id,is_group_buy,name client_name,count(user_id)over(partition by user_id) cnt
from order_info o
left join client c
on o.client_id=c.id
where date >'2025-10-15'
and product_name in("c++","python","java")
and status ='completed' )a
where cnt >=2
order by id
简单说,没啥想法,顺着题意一个一个写条件就好了,但我想吐槽的是,我没列没写别名居然也通过了。