select t3.user_id,t3.first_buy_date,t4.second_buy_date,t3.cnt from( select user_id,`date` first_buy_date,cnt from( select user_id,`date`,product_name, dense_rank() over(partition by user_id order by `date`) rk, count(1) over(partition by user_id) cnt from order_info where dat...