Re: Need help with a function boolean --> text or array

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:09:20
Message-ID: 9b1af80e0801222109s596c5c4em7587da71c417dc6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Patch:
select id, name, rtrim(leading ' ,' from
(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;

Doesn't look too fancy though...

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Raimon Fernandez 2008-01-23 08:10:09 using column alias to make operations
Previous Message Vyacheslav Kalinin 2008-01-23 05:03:39 Re: Need help with a function boolean --> text or array