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

异常的邮件概率

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

#sum(type = "no_completed") / count(*) 等价于 sum(case when type = "no_completed" then 1 else 0 end) / count(*)

select date, round(sum(type = "no_completed") / count(*), 3) as p
from email as t1
     join user as t2 on t1.send_id = t2.id
     join user as t3 on t1.receive_id = t3.id
where t2.is_blacklist = 0 and t3.is_blacklist = 0
group by date
order by date;

全部评论

相关推荐

02-16 13:52
门头沟学院 Java
给🐭🐭个面试机会吧:嘿,mvbatis
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务