自己感觉最简单的一版了 select user_id,min(fir),min(sec),count(user_id) cnt from ( select user_id,date,fir,if(r1=2,date,null) sec from ( select user_id,date,min(date)over(partition by user_id) fir,row_number()over(partition by user_id order by date) r1 from ( select user_id,date,if(product_name in('C++','Java','Python') and status='completed',1,0) r2 from order_info) t3 where r2=1 and date>'2025-10-15') t1 ) t2 group by user_id having count(user_id)>=2 order by user_id;