日期:2014-05-17 浏览次数:20474 次
select age as 年龄,count(age) as 受检人数 ,
sum(case when gender=1 then 1 else 0 end) 女生人数 ,
sum(case when R1=1 then 1 else 0 end) 月经初潮人数,
cast(cast (sum(case when R1=1 then 1 else 0 end)*100/((count(age)*1.0)) as float) as nvarchar)+'%' as 月经发生率,
sum(case when gender=0 then 1 else 0 end) 男生人数 ,
sum(case when R2=1 then 1 else 0 end) 首次遗精人数,
cast(cast (sum(case when R2=1 then 1 else 0 end)*100/((count(age)*1.0)) as float) as nvarchar)+'%' as 首次遗精率
from tab where age>=7 and age<=18 group by age