select 性别,count(*) from a group by 性别; 然后你遍历一下就知道了。如果你一定用一条语句 select all,man,women from (select count(*) all from a) aa,(select count(*) man from a where 性别='男') bb,(select count(*) women from a where 性别='女') cc;
select sum(decode(性别,'男',1,0)) man_num,sum(decode(性别,'女',1,0)) woman_num from yourtable
然后你遍历一下就知道了。如果你一定用一条语句
select all,man,women from (select count(*) all from a) aa,(select count(*) man from a where 性别='男') bb,(select count(*) women from a where 性别='女') cc;
from yourtable