select
count
(*)
as
人口总数,
sum
(
case
when
sex=0
then
1
else
0
end
) 男人数,
sum
(
case
when
sex=0
then
1
else
0
end
)*1.0/
count
(*)男所占比例,
sum
(
case
when
sex=1
then
1
else
0
end
) 女人数,
sum
(
case
when
sex=1
then
1
else
0
end
)*1.0 /
count
(*)女所占比例
from
cj_yonghu