Say we have a table
table posts +---------+-----------+--------------------------------+ | postId | title | status | bodyText | +--------
In MySQL:
MySQL
SELECT status, GROUP_CONCAT(title SEPARATOR ', ') FROM posts GROUP BY status
In PostgreSQL:
PostgreSQL
SELECT status, ARRAY_TO_STRING( ARRAY( SELECT title FROM posts pi WHERE pi.status = po.status )) FROM posts po GROUP BY status