I've got a table of student information in MySQL that looks like this (simplified):
|   age : int   |   city : text   |   name : text   |
-----------------------------------------------------
|               |                 |                 |
I wish to select all student names and ages within a given city, and also, per student, how many other students in his age group (that is, how many students share his age value).
I managed to do this with a sub-query; something like:
select 
   name, 
   age as a, 
   (select 
       count(age) 
    from 
       tbl_students 
    where 
       age == a) 
from 
   tbl_students 
where 
   city = 'ny'
But it seems a bit slow, and I'm no SQL-wiz, so I figure I'd ask if there's a smarter way of doing this. The table is indexed by age and city.