题解 | #牛客每个人最近的登录日期(三)#
牛客的课程订单分析(五)
http://www.nowcoder.com/practice/348afda488554ceb922efd2f3effc427
select user_id,min(date) first_buy_date,
max(date) second_buy_date,
max(count1) cnt from
(select * from
(select *,dense_rank() over(partition by user_id order by date) as rank1,
count(*) over(partition by user_id) as count1
from order_info where
date>'2025-10-15' and
status='completed' and
product_name in ('c++','java','python')) a
where count1>1 and rank1 in (1,2)) b
group by user_id
order by user_id 
