1 1/1+2+3+4
2 2/1+2+3+4
3 3/1+2+3+4
4 4/1+2+3+4
如上所示!
感谢帮助!
9 个解决方案
#1
select a,a/(select sum(a) from 表) b from 表
#2
select a, a/b.sumValue from
table1,(select sum(table1.a) as sumValue)b
table1,(select sum(table1.a) as sumValue)b
#3
select a,cast(a/(select sum(a)+0.0 from 表)*100 as int) b from 表
#4
如果要保留三位小数呢!?
#5
1.000%
#6
select a,cast(a/(select sum(a)+0.0 from 表) as numeric(10,3)) b from 表
#7
select a,cast(cast(a/(select sum(a)+0.0 from 表)*100 as numeric(10,3)) as varchar(10))+'%' b from 表
#8
+0.0为啥!?,转成浮点!?
#9
select a,cast(a/(select cast(sum(a) as numeric(10,3)) from test8) as numeric(10,3)) from test8
#1
select a,a/(select sum(a) from 表) b from 表
#2
select a, a/b.sumValue from
table1,(select sum(table1.a) as sumValue)b
table1,(select sum(table1.a) as sumValue)b
#3
select a,cast(a/(select sum(a)+0.0 from 表)*100 as int) b from 表
#4
如果要保留三位小数呢!?
#5
1.000%
#6
select a,cast(a/(select sum(a)+0.0 from 表) as numeric(10,3)) b from 表
#7
select a,cast(cast(a/(select sum(a)+0.0 from 表)*100 as numeric(10,3)) as varchar(10))+'%' b from 表
#8
+0.0为啥!?,转成浮点!?
#9
select a,cast(a/(select cast(sum(a) as numeric(10,3)) from test8) as numeric(10,3)) from test8