select t.user_id from (SELECT user_id, log_time, TIMESTAMPDIFF ( day, MIN(log_time) OVER ( PARTITION BY user_id ), log_time ) + 1 AS timediff, row_number() over(partition by user_id order by log_time) as rank_day, (TIMES...