题解 | #牛客的课程订单分析(四)#
牛客的课程订单分析(四)
http://www.nowcoder.com/practice/c93d2079282f4943a3771ca6fd081c23
select o.user_id,min(o.date) first_buy_date,count(o.product_name) cnt
from order_info o
join
(select distinct user_id
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ("C++","Java","Python")
group by user_id
having count(user_id) >= 2) t
on o.user_id = t.user_id
where product_name in ("C++","Java","Python")
and status = 'completed'
and date > '2025-10-15'
group by o.user_id
order by o.user_id;