SELECT a.id AS pipeId, a.name AS pipeName,ifnull(SUM(d.`sumDayFlow`),0) AS DayFlow, ifnull(SUM(d.`sumFlow`),0) as `CountFlow`, ifnull(SUM(d.`sumFlow`),0) - ifnull(SUM(d.`sumDayFlow`),0) AS NightFlow,d.dt FROM `aws_tarch_pipe_info` a LEFT JOIN `aws_tarch_client` b ON a.id = b.pipeId LEFT JOIN `aws_tarch_cjq` c ON b.id = c.clientId LEFT JOIN `aws_tarch_sign_day` d ON b.id = d.clientId AND d.dt >= UNIX_TIMESTAMP('${时间} ') AND d.dt <= UNIX_TIMESTAMP('${时间} ') AND d.clientId = b.id WHERE a.type = 1 GROUP BY a.id