how to solve this problem

Поиск
Список
Период
Сортировка
От ivan marchesini
Тема how to solve this problem
Дата
Msg-id 1144934290.5079.32.camel@geologia5.agora.ing.unipg.it
обсуждение исходный текст
Ответы Re: how to solve this problem  (Richard Broersma Jr <rabroersma@yahoo.com>)
Re: how to solve this problem  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-sql
Dear users,
I have this problem 

I have a table where there are 20 columns named
vinc1, vinc2, vinc3, vinc4, etc....

the values contained into each column are simply 1 or 0  (each column is
dichotomic)
1 means presence
0 means absence

I would obtain a column (new_column) containg the name of the columns,
comma separated, where the value is = 1

for example:

vinc1    vinc2    vinc3    vinc4    new_column
1    0    1    0    vinc1,vinc3
0    0    0    1    vinc4
0    1    1    1    vinc2,vinc3,vinc4

can someone help me to find the best way to obtain this result???
thank you very much

Ivan







-- 
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a 
06125
Perugia (Italy)
e-mail: marchesini@unipg.it       ivan.marchesini@gmail.com
tel: +39(0)755853760
fax: +39(0)755853756
jabber: geoivan73@jabber.org





В списке pgsql-sql по дате отправления:

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: trigger to enforce FK with nulls?
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: how to solve this problem