日期:2014-05-17 浏览次数:20507 次
select sum(case d.task_state when 0 then 1 else 0 end)/sum(1), sum(case d.task_state when 0 then 1 else 0 end), sum(1) from week_task_result d
select sum(case d.task_state when 0 then 1 else 0 end)* 1.0/sum(1), sum(case d.task_state when 0 then 1 else 0 end), sum(1) from week_task_result d
------解决方案--------------------
select sum(case d.task_state when 0 then 1 else 0 end)*1.0/sum(1), sum(case d.task_state when 0 then 1 else 0 end), sum(1) from week_task_result d
------解决方案--------------------
精度问题
------解决方案--------------------
整数和整数乘除,结果为整数。。而23/24=0.958333,所以取整成了0。