From: | "Vyacheslav Kalinin" <vka(at)mgcp(dot)com> |
---|---|
To: | Andreas <maps(dot)on(at)gmx(dot)net> |
Cc: | ListaPostgre <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Need help with a function boolean --> text or array |
Date: | 2008-01-23 05:03:39 |
Message-ID: | 9b1af80e0801222103l3e245ba7l92f75fbed7df9181@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Jan 23, 2008 7:19 AM, Andreas <maps(dot)on(at)gmx(dot)net> wrote:
> Hi,
>
> I've got a table with a couple of boolean columns which represent
> attributes of entities.
> Now I need to list those entities with the attributes cumulated into one
> text-column.
> How could I do this?
>
> Uh,
select id, name, (case when has_olive then 'Olive' else '' end) ||
(case when has_cheese then ', Cheese' else '' end)
||
(case when has_onion then ', Onion' else '' end)
||
(case when has_salami then ', Salami' else '' end)
||
(case when has_egg then ', Egg' else '' end) ||
(case when has_extra_hot_chilies then ', Extra hot
chilies' else '' end) as addons
from pizzas;
From | Date | Subject | |
---|---|---|---|
Next Message | Vyacheslav Kalinin | 2008-01-23 05:09:20 | Re: Need help with a function boolean --> text or array |
Previous Message | Andreas | 2008-01-23 04:19:58 | Need help with a function boolean --> text or array |