can someone please tell me how you would output this? Output it like Location M F Total.
SELECT location, SUM(IF(gender='M',1,0)) AS M,
SUM(IF(gender='F',1,0)) AS F, COUNT(*) AS total
GROUP by location;
Taken from – http://dev.mysql.com/tech-resources/articles/wizard/page3.html
Thanks
EDIT
How to get answers like
location M F total
Boston 1 2 3
Cagliari 1 2 3
London 1 1 2
Manchester 1 1 2
Marseille 1 2 3
Milano 2 0 2
New York 2 2 4
Paris 1 1 2
Roma 3 0 3
loop through it and echo it into a table: