题解 | #找出待召回的流失用户# 小白拆解做法

找出待召回的流失用户

https://www.nowcoder.com/practice/74ec0a3766bf480ab7690486943678a4

with tiaojian as (
select
uid,
count(id) as times
from user_login_tb
group by uid
having count(id)>=3
),tiaojian1 as (
select 
uid,
count(distinct login_date) as days
from user_login_tb
group by uid
having datediff((select max(login_date) from user_login_tb),max(login_date))>29
)

select 
t.uid,
t1.days,
t.times
from tiaojian t inner join tiaojian1 t1 on t.uid=t1.uid
order by days desc,times desc

全部评论

相关推荐

不愿透露姓名的神秘牛友
03-29 08:32
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务