【发布时间】:2012-12-05 10:29:16
【问题描述】:
我有以下查询,结果出乎我的意料:
select stato, (count(1) *100) / sum(1)
from LOG_BONIFICA
group by stato;
它为所有行返回 100。应该不一样吗?
【问题讨论】:
-
在count()和sum()中指定列名..
-
@Gik25:只需在查询中尝试
select stato, count(1) ,sum(1),然后您就会知道为什么每行都得到 100。您能告诉我们您对 count 的期望吗(1) 和总和 (1)