select
  a.性别,
  未婚的人数=sum(case b.是否结婚 when '否' then 1 else 0 end)
from
  a,b
where
  a.编号=b.编号
group by
  a.性别