--统计图(比例大于5,统计各类,比例小于5的则汇总统计值)
select * from (
select name,
sum(rs) as rs,
round(ratio_to_report(sum(rs)) over(), 5) * 100 as bl
from (select *from test) a
group by name
)
where bl>=5
union all
select '其他',sum(rs),sum(bl) from (
select name,
sum(rs) as rs,
round(ratio_to_report(sum(rs)) over(), 5) * 100 as bl
from (select * from test) a
group by name
)
where bl<5
oracle统计各类数据(ratio_to_report函数,计算比例)
最新推荐文章于 2021-08-16 17:19:35 发布