select Count(name) as '男生总数' from table where sex='男'
union
select Count(name) as '男生总数' from table where sex='女'
select sum(case when sex='男' then 1 else 0 end),
sum(case when sex='女' then 1 else 0 end)
from tab
SELECT T.SEX,COUNT(*) FROM A_TEST T GROUP BY T.SEX;
select count(sex) from table group by sex
select (select count(*) from test where sex='男') 男,(select count(*) from test where sex='女') 女 from dual;