X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3BD5911F6716 for ; Thu, 13 Apr 2006 10:16:01 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.276 X-Spam-Level: X-Spam-Status: No, score=0.276 required=5 tests=[MAILTO_TO_SPAM_ADDR=0.276] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id IyaPI3UnQn63 for ; Thu, 13 Apr 2006 10:15:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from trabant.cianoz.org (host31-194-149-62.serverdedicati.aruba.it [62.149.194.31]) by postgresql.org (Postfix) with ESMTP id 871D411F6613 for ; Thu, 13 Apr 2006 10:15:54 -0300 (ADT) Received: by trabant.cianoz.org (Postfix, from userid 1031) id 608A1384024; Thu, 13 Apr 2006 15:15:54 +0200 (CEST) Received: from geologia5.agora.ing.unipg.it (geologia5.agora.ing.unipg.it [141.250.41.212]) by trabant.cianoz.org (Postfix) with ESMTP id 218CA38401A for ; Thu, 13 Apr 2006 15:15:52 +0200 (CEST) Subject: how to solve this problem From: ivan marchesini Reply-To: marchesini@unipg.it To: pgsql-sql@postgresql.org Content-Type: text/plain Organization: University of Perugia Date: Thu, 13 Apr 2006 15:18:10 +0200 Message-Id: <1144934290.5079.32.camel@geologia5.agora.ing.unipg.it> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.80 (http://www.clamav.net) X-Archive-Number: 200604/88 X-Sequence-Number: 24897 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