select * 如下所示
select state,COUNT(entertime) from Traffic group by State 如下所示
现在想select一个百分比=座席接听/(总数-黑名单)
求SQL语句
------解决方案--------------------
select sum(case when State='座席接听' then 1 esle 0 end)*1./(count(1)-sum(case when State='系统未接听-黑名单' then 1 esle 0 end))
from Traffic
------解决方案--------------------
因为两个整数相除的话,默认会向下取整,这样显示出来就一直都是0.