题解 | #查询连续登陆的用户#
查询连续登陆的用户
https://www.nowcoder.com/practice/9944210610ec417e94140ac09512a3f5
with tiaojian as ( select tb.user_id, date(log_time) as pw, row_number()over(partition by tb.user_id order by date(log_time) asc ) as pn from register_tb rb inner join login_tb tb on rb.user_id=tb.user_id ) select distinct user_id from tiaojian group by user_id,subdate(pw,pn) having count(user_id)>=3 order by user_id