Joseph Hesse:
>--------------
>SELECT Age, COUNT(*) AS Total, COUNT(Gender='Male') AS Men,
>COUNT(Gender='Female') AS Women FROM Persons
>GROUP BY Age
>--------------
As Pointed Ears kindly and politely replied, this is not the proper
way. But I assume that you wrote this mainly as semi-code in order to
make your thoughts clear to c.d.m.
>
>+-----+-------+-----+-------+
>> Age | Total | Men | Women |
>+-----+-------+-----+-------+
>> 18 | 3 | 3 | 3 |
>> 19 | 1 | 1 | 1 |
>+-----+-------+-----+-------+
>
>The above output should show that there are 2 Males and 1 Female who
>are age 18. This is not the case.
Here's my attempt (untested on your data):
SELECT Age,
COUNT(*) AS Total,
SUM( IF(Gender="Male", 1, 0) ) AS Men,
SUM( IF(Gender="Female", 1, 0) ) AS Women
FROM Persons
GROUP BY Age
--
Erick