a 4
b 5
c 7
d 8
e 9
f 3
g 7
我怎么求a占F2总数的百分比,b占F2总数的百分比.......
7 个解决方案
#1
select f1,f2,(f2/sum(f2))*100 as bfb from tablename
#2
楼上不对啊
#3
select f1, f2, f2/(select sum(f2) from ci_user)*100 from tablename
测试过OK的
测试过OK的
#4
select f1,(f1/sum(f2))*100 from TB group by f1
#5
select t.f1,t.f2,(t.f2/s.n)*100 as num from tab as t,(select sum(f2) as n from tab) as s
#6
楼上不对啊,呵呵
语法就有错误啊
select A.f1 , A.f2 , A.f2/B.sumB*100
from tablename A , (select sum(f2) as sumB from tablename) B
语法就有错误啊
select A.f1 , A.f2 , A.f2/B.sumB*100
from tablename A , (select sum(f2) as sumB from tablename) B
#7
select f1,(f1/sum(f2))*100 from TB group by f1不满足需要,
出来的应该是
a 100
b 100
c 100
d 100
e 100
f 100
g 100
出来的应该是
a 100
b 100
c 100
d 100
e 100
f 100
g 100
#1
select f1,f2,(f2/sum(f2))*100 as bfb from tablename
#2
楼上不对啊
#3
select f1, f2, f2/(select sum(f2) from ci_user)*100 from tablename
测试过OK的
测试过OK的
#4
select f1,(f1/sum(f2))*100 from TB group by f1
#5
select t.f1,t.f2,(t.f2/s.n)*100 as num from tab as t,(select sum(f2) as n from tab) as s
#6
楼上不对啊,呵呵
语法就有错误啊
select A.f1 , A.f2 , A.f2/B.sumB*100
from tablename A , (select sum(f2) as sumB from tablename) B
语法就有错误啊
select A.f1 , A.f2 , A.f2/B.sumB*100
from tablename A , (select sum(f2) as sumB from tablename) B
#7
select f1,(f1/sum(f2))*100 from TB group by f1不满足需要,
出来的应该是
a 100
b 100
c 100
d 100
e 100
f 100
g 100
出来的应该是
a 100
b 100
c 100
d 100
e 100
f 100
g 100