我有3种计数,持续时间和百分比。我使用汇总来计算总数和持续时间,但我希望获得百分比列的平均值。
select to_char(anstime,'HH24'),
count(anstime),
sum(billdurtn),
round((sum(billdurtn)/(30*3600*1))*100,2)
from crm.t_ivr_detailed_logs
where date(anstime)='2018-06-22'
group by rollup(to_char(anstime,'HH24'))
答案 0 :(得分:2)
用
替换您的round((sum(billdurtn)/(30*3600*1))*100,2)
avg(SELECT round((sum(billdurtn)/(30*3600*1))*100,2)
FROM crm.t_ivr_detailed_logs
where date(anstime)='2018-06-22'
group by rollup(to_char(anstime,'HH24')))
.....