codice:
select professione,
sum(if(sesso='M',1,0)) as uomini,
sum(if(sesso='F',1,0)) as donne
from tabella
group by professione