SELECT count(id) as total,sum(case when(sex="男") then 1 else 0 end)as man ,sum(case when(sex="女") then 1 else 0 end) as woman from tb_user
SELECT count(id) as total,count(case when(sex="男") then 1 else null end)as man ,count(case when(sex="女") then 1 else null end) as woman from tb_user