【发布时间】:2016-01-17 04:44:44
【问题描述】:
我有这个问题:
Select count(incidentnumber) as average
from incidents
Where IncidentStationGround <> firstpumparriving_deployedfromstation;
我得到了一个结果,大概是 20,000。但是我怎样才能把这个数字转换成百分比呢?另外,我想要十进制的结果,可以吗?
【问题讨论】:
-
这行得通吗?
Select (count(incidentnumber)*100 /(select count(incidentnumber) from incidents)) as score from incidents Where IncidentStationGround <> firstpumparriving_deployedfromstation;
标签: sql postgresql casting aggregate-functions percentage