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

查询连续登陆的用户

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

全部评论

相关推荐

要冲外企的祖国花朵很温柔:今年有签约礼盒嘛
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
12-17 17:43
Java抽象带篮子:绝绝子暴风吸入啊
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务