with a as( select l.user_id as user_id, substring(log_time,1,10) as time from login_tb l join register_tb r on l.user_id=r.user_id ), b as(select distinct * from a), c as ( select user_id, time, row_number() over(partition by user_id) as datediff from b group by user_id,time ), d as( select user_id,...