where 竟然可以并列判断 哈哈哈学到了

select
    t1.date,
    round(no_completed/count_completed,3) p
from
(
        select
        date,
        count(*) count_completed,
        sum(if(type='no_completed',1,0)) no_completed
    from email
    where send_id and receive_id not in
        (select
            id
        from user
        where is_blacklist=1)
    group by date
)t1