I have a MySQL table (voters) of voter data in the following format:
id | name | gender | const
I need to output the following:
const | no. of female voters | no. of male voters | total no. of voters
order by no. of female voters.
I could only come up with this query:
select const,count(*) from voters where gender='f' group by const order by count(*) desc
How do I get other two counts too? const means constituency, gender can be either 'm' or 'f'