首先在数据排除黑名单客户,在user表中找到黑名单 SELECT u.`id` from `user` u where is_blacklist=1然后在date表中的where条件下排除,黑名单有可能是多个用户 where e.send_id !=(SELECT u.`id` from `user` u where is_blacklist=1) and e.receive_id !=(SELECT u.`id` from `user` u where is_blacklist=1) 按日期排列 group by e.date用avg 和 case when then else 计算每...