Re: Concatenating several rows - Mailing list pgsql-novice

From George Pavlov
Subject Re: Concatenating several rows
Date
Msg-id 8C5B026B51B6854CBE88121DBF097A867DC932@ehost010-33.exch010.intermedia.net
Whole thread Raw
In response to Concatenating several rows  ("Pierre Thibaudeau" <pierdeux@gmail.com>)
Responses Re: Concatenating several rows  ("Pierre Thibaudeau" <pierdeux@gmail.com>)
List pgsql-novice
make it an array first:

SELECT array_to_string(array(SELECT name FROM pseudonyms WHERE
person_id=125), ' ');


> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of
> Pierre Thibaudeau
> Sent: Monday, January 29, 2007 6:50 PM
> To: pgsql-novice@postgresql.org
> Subject: [NOVICE] Concatenating several rows
>
> SELECT name FROM pseudonyms WHERE person_id=125;
>
> I know in advance that this query yields between 0 and 5 rows of
> results, depending on the actual person_id.
>
> How can I concatenate those results into one text string?
> Something like:
>
> SELECT array_to_string( (SELECT name FROM pseudonyms WHERE
> person_id=125), ' ');
>
> which doesn't work...
>

pgsql-novice by date:

Previous
From: "Pierre Thibaudeau"
Date:
Subject: Concatenating several rows
Next
From: "Pierre Thibaudeau"
Date:
Subject: Re: Concatenating several rows