You could just do this aggregation in your query:
SELECT Age, STRING_AGG(Name, ',') AS Names FROM people GROUP BY Age ORDER BY Age
Output:
Age Names 12 Gessica,Alice,Max 23 Federica 34 Jack
Demo on db-fiddle
1.4m articles
1.4m replys
5 comments
57.0k users