在牛客的课程订单分析(四)的基础上左连接即可
SELECT
a.id,
a.is_group_buy,
b.name client_name
FROM
(
SELECT
*,
ROW_NUMBER() over(partition by user_id order by date) r,
count(product_name) over(partition by user_id) cnt
from order_info
where status='completed'
and date>'2025-10-15'
and product_name in('C++','Java','Python')
)a
left join client b
on a.client_id=b.id
where a.cnt>=2
group by 1
order by 1