--自测sql
select e.date
--将type进行转换为1
--CAST函数用于将某种数据类型的表达式显式转换为另一种数据类型。包括用AS关键字分隔的源值和目标数据类型。
--语法:CAST (expression AS data_type)
,cast(count(case when type='no_completed' then 1 else null end)*1.0 / count(id) as decimal(10,3))
from email e
where e.send_id in (select id from user where is_blacklist=0)
and e.receive_id in (select id from user where is_blacklist=0)
group by e.date
order by e.date asc