题解 | #牛客的课程订单分析(五)#
牛客的课程订单分析(五)
http://www.nowcoder.com/practice/348afda488554ceb922efd2f3effc427
select c.user_id, c.first_buy_date, c.date second_buy_date, c.cnt from (select a.*, b.date, dense_rank() over (partition by a.user_id order by b.date) t from (select user_id, min(date) first_buy_date, count(user_id) cnt 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 order by user_id) a join (select * from order_info where date >= '2025-10-15' and status= 'completed' and product_name in ('C++', 'Java', 'Python')) b on a.user_id=b.user_id ) c where c.t=2
