------=_Part_22786_20037450.1201064619250
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Jan 23, 2008 7:19 AM, Andreas 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;

------=_Part_22786_20037450.1201064619250
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline



On Jan 23, 2008 7:19 AM, Andreas <maps.on@gmx.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;



------=_Part_22786_20037450.1201064619250--