题解 | 查询连续登陆的用户
select user_id from (select user_id, start_date, count(start_date) cnt from (select *, date_sub(log_date, interval rk day) start_date from (select distinct user_id, date(log_time) log_date, dense_rank() over(partition by user_id order by date(log_time)) rk from login_tb) t1) t2 group by user_id, start_date) t3 where user_id in (select user_id from register_tb) group by user_id having max(cnt)>=3 order by user_id asc;