count(distinct cc.callednumber) as 外呼客户总数 , count( cc.callednumber) as 外呼次数 , count(distinct cc.callednumber) as 接通客户数 
from Agent a , AgentGroup b , AgentGroupRelation c , (SELECT * FROM cc_calldetail UNION SELECT * FROM cc_calldetail_bak)  cc 
 where  cc.calltype between  3 and  5   
 and a.agentid = c.agentid and b.groupid = c.groupid  and a.agentcode =cc.firstagentId 
 and  b.groupId IN('SHNKAG0000000001','SHNKAG0000000005')
 group  by a.agentCode ,a.Name如上的SQL语句
查询的结果是
工号 姓名 工时 外呼客户总数 外呼次数 接通次数
1060 1005  504  2            4         2
1061 1001  252  1            2         1
1062 1006  376  2            4         2
但是发现结果有误实际应该为
1060 1005  126  2            4         2
1061 1001   63  1            2         1
1062 1006  126  2            4         2
在下想问一下这该怎么处理?
还有就是多个聚合函数时怎么控制?
谢谢