select 日期,count(if(枚举类型 = 'no_completed',枚举类型,null))/count(*) as 失败率 from 邮件表
where 寄信人编号 in
(select 用户编号 from 用户表
where 是否为黑名单 = 0)
and 收信人编号 in
(select 用户编号 from 用户表
where 是否为黑名单 = 0)
group by 日期
order by 日期