【发布时间】:2021-07-08 16:33:42
【问题描述】:
我有一个问题:
select no_tipo_origem,
count(*) total
from table
group by no_tipo_origem
结果是:
tipo 1 | 25
tipo 2 | 133
tipo 3 | 48
我需要这样计算百分比:
tipo 1 | 25 | 12.1
tipo 2 | 133 | 64.5
tipo 3 | 48 | 23.3
【问题讨论】:
标签: postgresql count sum window-functions percentage