SQL查询比例的问题

查询工资在1000至1500之间的员工在所有员工中所占的比例!

这个该怎么查询啊~求各位高手解答

select ((select count(*) from 表名 where 工资 between 1000 and 1500 )*100/(select count(*) from 表名))

显示的直接就是百分比.
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-05-12
select a.number1/b.number2 from
(select count(*) number1 from 表名 where 工资 between 1000 and 1500) a,
(select count(*) number2 from 表名) b
第2个回答  2009-05-12
select rtrim(cast(sum(case when 工资 between 1000 and 1500 then 1 else 0 end)*1.0/count(*)*100) as numeric(18,2)))+'%'
from table