题解 | #查询连续登陆的用户#
查询连续登陆的用户
https://www.nowcoder.com/practice/9944210610ec417e94140ac09512a3f5
select user_id from( select user_id, date_sub(log_time,interval rk day) as newdate from(select user_id, date(log_time) as log_time, rank() over(partition by user_id order by log_time) as rk from login_tb where user_id in (select user_id from register_tb) ) t1 ) t2 group by user_id,newdate having count(newdate)>=3 order by user_id
为啥先创建两个虚拟表,再筛选连续登录用户,就一直报错呢?