# 先找到满足条件的记录
select a.id, a.is_group_buy, b.name
from (
    select id, user_id, client_id, is_group_buy
    from order_info 
    where user_id in (
        select user_id
        from order_info 
        where date > '2025-10-15'
        and product_name in ('Python', 'Java', 'C++')
        and status = 'completed'
        group by user_id
        having count(id) >= 2
    )
    and date > '2025-10-15'
    and product_name in ('Python', 'Java', 'C++')
    and status = 'completed'
) as a
left join client as b
on a.client_id = b.id
order by a.id;