日期:2014-05-17 浏览次数:20472 次
SELECT
address,
convert(varchar(10), cast(COUNT(1)*100/(select count(1) from test) as dec(18,2))) + '%' AS T
FROM test
GROUP BY address
select address,100*CAST(num as float)/CAST(totalcount as float) as scale from (
select address,(select COUNT(*) from A) as totalcount,COUNT(*) as num from A group by address) A
/*
北京 28.5714285714286
海南 14.2857142857143
河南 14.2857142857143
山西 14.2857142857143
陕西 28.5714285714286
*/