我用的,通过
SELECT 接单操作员,CONVERT(CHAR(7),CAST(操作日期 AS SMALLDATETIME),20) AS 操作日期,SUM(接单数量) as 接单数量,sum(派单数量) as 派单数量,sum(返单数量) as 返单数量,sum(回访数量)as 回访数量 FROM
((SELECT 接单操作员,CAST(接单时间 AS INT) AS 操作日期, COUNT(*) as 接单数量,0 as 派单数量,0 as 返单数量,0 as 回访数量 FROM REC_INFO group by 接单操作员,CAST(接单时间 AS INT)) union
(SELECT 派单操作员,CAST(派单时间 AS INT),0,COUNT(*),0,0 from send_info group by 派单操作员,CAST(派单时间 AS INT)) union
(SELECT 返单操作员,CAST(返单日期 AS INT),0,0,COUNT(*),0 from ret_info group by 返单操作员,CAST(返单日期 AS INT)) union
(SELECT 回访操作员,CAST(回访时间 AS INT),0,0,0,COUNT(*) from response_info group by 回访操作员,CAST(回访时间 AS INT))) as t
WHERE 接单操作员 like '%' AND (操作日期 BETWEEN 30000 AND 40000) GROUP BY 接单操作员,CONVERT(CHAR(7),CAST(操作日期 AS SMALLDATETIME),20) ORDER BY 接单操作员,操作日期