题解 | #查询连续登陆的用户#

查询连续登陆的用户

https://www.nowcoder.com/practice/9944210610ec417e94140ac09512a3f5

with a as(
    select t2.user_id,reg_time,log_time,rank()over(partition by t2.user_id order by log_time) as time
    from register_tb as t1 inner join login_tb as t2
    on t1.user_id=t2.user_id
    group by t2.user_id,reg_time,log_time
)
select user_id 
from a
where time>=3
    
    

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务