我有这个查询,我必须计算多个字段
select
distinct(custsegment),
(select count(distinct clid) from call_log where enteredon = '16-JUL-13') as UniqCalls,
(select count(disconnectflag) from call_log where disconnectflag='IVR' and enteredon = '16-JUL-13') as IvrCalls,
(select count(callerid) from call_log where enteredon = '16-JUL-13') as TotalCalls
from call_log
where enteredon = '16-JUL-13'
输出是
CUSTSEGMENT UNIQCALLS IVRCALLS TOTALCALLS
------------ ---------- ---------- ----------
PRIORITY 12 6 12
NORMAL 12 6 12
但是问题似乎我得到了 PRIORITY 和 NORMAL CUTSEGMENT 相同的值,我也不确定这是否是计算它的正确方法。请建议。