由网友(诗言佐酒)分享简介:Hi我如何才能获得每条记录占总数的百分比?假设我有一张表,其中包含以下内容ID code Points1 101 22 201 33 233 44 123 1ID 1的百分比为20%,2的百分比为1我如何获得它?推荐答案尝试如下select id,code,points,(poin...
Hi我如何才能获得每条记录占总数的百分比? 假设我有一张表,其中包含以下内容
ID code Points
1 101 2
2 201 3
3 233 4
4 123 1
ID 1
的百分比为20%
,2
的百分比为1
我如何获得它?
推荐答案
尝试如下
select id,code,points,(points * 100)/(select sum(points) from tabel1) from table1
相关推荐
最新文章