仅供参考
牛客的课程订单分析(六)
http://www.nowcoder.com/questionTerminal/c5736983c322483e9f269dd23bdf2f6f
select id, is_group_buy, name
from (
select t1.id, t1.is_group_buy, t2.name, count(product_name) over (partition by user_id) as cnt
from order_info t1 left outer join client t2
on t1.client_id=t2.id
where status='completed' and product_name in ('Java','C++','Python') and date>='2025-10-15') a
where cnt>=2
order by id;
from (
select t1.id, t1.is_group_buy, t2.name, count(product_name) over (partition by user_id) as cnt
from order_info t1 left outer join client t2
on t1.client_id=t2.id
where status='completed' and product_name in ('Java','C++','Python') and date>='2025-10-15') a
where cnt>=2
order by id;