-- 使用case when 或者 if,内部使用窗口函数selectcase when t1.is_group_buy = 'Yes' then 'GroupBuy' else c.name end source,count(*) as cntfrom client cright join(select *,count(id)over(partition by user_id) as numberfrom order_infowhere datediff(date,'2025-10-15')>1and status = 'completed'and product_name in ('...