SQL - How to display the students with the same age?
        Posted  
        
            by 
                Cristian
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Cristian
        
        
        
        Published on 2011-01-14T04:11:30Z
        Indexed on 
            2011/01/14
            6:53 UTC
        
        
        Read the original article
        Hit count: 290
        
the code I wrote only tells me how many students have the same age. I want their names too...
SELECT YEAR(CURRENT DATE-DATEOFBIRTH) AS AGE, COUNT(*) AS HOWMANY
FROM STUDENTS
GROUP BY YEAR(CURRENT DATE-DATEOFBIRTH);
this returns something like this:
AGE      HOWMANY
---      -------
21       3
30       5
Thank you.
TABLE STUDENTS COLUMNS:
StudentID (primary key), Name(varchar), Firstname(varchar), Dateofbirth(varchar)
I was thinking of maybe using the code above and somewhere add the function concat that will put the stundents' names on the same row as in
© Stack Overflow or respective owner