Posted by: raajkm July 5, 2019
Please help on Sql query
Login in to Rate this Post:     0       ?        
select x.*, rownum as day_num from (
select to_date((to_char(dateOfBirth, 'YYYY-MM-DD')),'YYYY-MM-DD') date_of_Birth, listagg(Name, ',') within group(order by Name) Name_of_students
from student
group by to_date((to_char(dateOfBirth, 'YYYY-MM-DD')),'YYYY-MM-DD')
) x;

this works for Oracle. If you are using mysql try using string_agg instead of listagg.
Read Full Discussion Thread for this article