with t as( select distinct date_format(in_time, '%Y%m') dt, uid, row_number()over(partition by uid order by date_format(in_time, '%Y%m%d')) rk, date_sub(date_format(in_time, '%Y%m%d'), interval row_number()over(partition by uid order by date_format(in_time, '%Y%m%d')) day) f_dt from tb_user_...