select sum(case when zhu_sheng>0 then 1.0 else 0 end)/count(1) from T_ziliaoku
下面这个显示位**%
select str(sum(case when zhu_sheng>0 then 1.0 else 0 end)/count(1)*100)+'%' from T_ziliaoku
注意 要1.0
因为
select 1/2=0
select 1.0/2才是0.5
select sum(case when zhu_sheng>0 then 1.0 else 0 end)/count(1) from T_ziliaoku
下面这个显示位**%
select str(sum(case when zhu_sheng>0 then 1.0 else 0 end)/count(1)*100)+'%' from T_ziliaoku
注意 要1.0
因为
select 1/2=0
select 1.0/2才是0.5