34,590
社区成员
发帖
与我相关
我的任务
分享
select
[类别],ltrim(cast(count(1)*100.0/(select count(1) from [表]) as decimal(18,2)))+'%' as 百分比
from
[表]
group by
[类别]
select 类别,ltrim(cast(count(1)*100.0/count(1)over() as decimal(6,2))) + '%' as [百分比]
from tb
group by 类别
select
[类别],ltrim(cast(count(1)*100./(select count(1) from [表]) as decimal(6,2)))+'%' as 百分比
from
[表]
group by
[类别]
select
[类别],ltrim(count(1)/(select count(1) from [表]))+'%' as 百分比
from
[表]
group by
[类别]
select [类别],count(1)/(select count(1) from [表])
from [表]
group by [类别]
select 类别,count(1)*1.0/count(1)over() from tb group by 类别