SELECT new.id, new.is_group_buy, IF(new.is_group_buy = 'Yes', NULL, c.name)
FROM(
    select *,
           count(*)over(partition by user_id ) as count
           -- 基于题目订单分析三,使用窗口函数更简洁
    FROM order_info
    WHERE date >= '2025-10-15'
    AND status ='completed'
    AND product_name in('C++','Python','Java')
) new 
-- FROM子句中的派生表必须重新命名,否则会报错
LEFT JOIN client c ON new.client_id = c.id
-- new表中存在client_id = 0的数据,但client表中没有,所以这里必须使用左连接,否则返回结果不全
WHERE new.count >= 2
ORDER BY id