Re: How do you do the opposite of regexp_split_to_table?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: John Gage <jsmgage(at)numericable(dot)fr>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How do you do the opposite of regexp_split_to_table?
Date: 2010-08-03 20:35:26
Message-ID: 1280867576-sup-2555@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Excerpts from John Gage's message of mar ago 03 16:21:58 -0400 2010:

> Grouping by summing numerical fields seems to be straightforward, but
> grouping by concatenating text fields escapes my search of the
> documentation.

You can create a new custom aggregate function that does this. It's
pretty straightforward. There are examples in the archives (search for
text_concat), but there's also a more modern way involving array_agg and
array_to_string.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Marc Mamin 2010-08-04 10:35:58 workaround for missing ROWNUM feature with the help of GUC variables
Previous Message John Gage 2010-08-03 20:21:58 How do you do the opposite of regexp_split_to_table?