Re: How best to turn select result into options like 'a|b|c''

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "Ray O'Donnell" <ray(at)rodonnell(dot)ie>
Cc: Shaozhong SHI <shishaozhong(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How best to turn select result into options like 'a|b|c''
Date: 2021-12-20 22:37:12
Message-ID: CAKFQuwY2norL3CZLWt9srwqwU5NE-cqTsZ5dkCzJuQL+B7kvEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 20, 2021 at 3:24 PM Ray O'Donnell <ray(at)rodonnell(dot)ie> wrote:

> On 20 December 2021 22:10:19 Shaozhong SHI <shishaozhong(at)gmail(dot)com> wrote:
>
>> Is there a way to turn select result into something like 'a|b|c' .
>> Regards,
>> David
>>
>
> On my phone so hard to reply properly, but if a, b and c are in separate
> rows then you need the array_agg() and array_to_string() functions.
>
>
Or just: string_agg()

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message James Sewell 2021-12-21 00:22:05 Re: Max connections reached without max connections reached
Previous Message Ray O'Donnell 2021-12-20 22:23:56 Re: How best to turn select result into options like 'a|b|c''