I always forget how to do things like this.
I have a database table with birthdates and I want to find out how many people have the same age.
I'm trying:
SELECT TIMESTAMPDIFF( YEAR, birthdate, CURDATE( ) ) AS age, COUNT( age )
FROM person
GROUP BY age
but get the error
Unknown column 'age' in 'field list'
How can I do a group by on a named column?