题解 | 牛客每个人最近的登录日期(三)

牛客每个人最近的登录日期(三)

https://www.nowcoder.com/practice/16d41af206cd4066a06a3a0aa585ad3d

select round(sum(cnt_1)/sum(cnt_all), 3) as p from(
select count(distinct t1.user_id) as cnt_all, if(sum(t2.date is not null and t1.date is not null)>=1, 1, 0) as cnt_1
from 
login as t1
left join
login as t2
on t1.user_id = t2.user_id and t2.date = date_add(t1.date, interval 1 day)
group by t1.user_id) as t3
# 用join

全部评论

相关推荐

UtopianYou...:这个简历排版真的不太行哦,去找免费的或者花点小钱,把排版弄整齐一点吧,看着舒服。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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