题解 | #异常的邮件概率#

异常的邮件概率

https://www.nowcoder.com/practice/d6dd656483b545159d3aa89b4c26004e

select date, round(count(case when type = 'no_completed' then 1 end)/count(type),3) as p
from email
left join user u1 on send_id = u1.id
left join user u2 on receive_id = u2.id
where u1.is_blacklist = 0 and u2.is_blacklist = 0
group by 1
order by 1 asc

很简单,先找到发送和接受都不是黑名单的用户的邮件记录,再统计no_completed的记录数量除以全部,再round 3

全部评论

相关推荐

头像
05-27 20:32
已编辑
深度学习
工行数据中心 偏运维养老 到手可能18w
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务