select date,format(count(if(type = 'no_completed',1,null)) / count(type),3) from email e,user u where e.send_id not in (select id from user where is_blacklist=1) ...