Since 9.0 this is even easier:
SELECT id,
string_agg(some_column, ',')
FROM the_table
GROUP BY id
More Related Contents:
- How to concatenate strings of a string field in a PostgreSQL ‘group by’ query?
- Refactor a PL/pgSQL function to return the output of various SELECT queries
- PostgreSQL “Column does not exist” but it actually does
- Is SELECT or INSERT in a function prone to race conditions?
- Any downsides of using data type “text” for storing strings?
- PostgreSQL: using a calculated column in the same query
- Optimise PostgreSQL for fast testing
- Fast way to discover the row count of a table in PostgreSQL
- How to delete duplicate rows without unique identifier
- Is there something like a zip() function in PostgreSQL that combines two arrays?
- Serial numbers per group of rows for compound key
- Return multiple fields as a record in PostgreSQL with PL/pgSQL
- Postgres analogue to CROSS APPLY in SQL Server
- Postgres not using index when index scan is much better option
- SQL update fields of one table from fields of another one
- Postgres – Function to return the intersection of 2 ARRAYs?
- How to store array or multiple values in one column
- convert Postgres geometry format to WKT
- Which datatype should be used for currency?
- Produce DISTINCT values in STRING_AGG
- How to return two columns with function
- COPY with dynamic file name
- Table or column name cannot start with numeric?
- PostgreSQL column ‘foo’ does not exist
- Prepared Statement on Postgresql in Rails
- SELECT DISTINCT is slower than expected on my table in PostgreSQL
- Postgresql query between date ranges
- How to use SQL LIKE condition with multiple values in PostgreSQL?
- Why isn’t row level security enabled for Postgres views?
- Is there a postgres CLOSEST operator?