X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id C501511F6C40 for ; Thu, 13 Apr 2006 10:51:14 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -0.236 X-Spam-Level: X-Spam-Status: No, score=-0.236 required=5 tests=[AWL=0.716, BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_WHOIS=1.447] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id kVaXnbNZwXWp for ; Thu, 13 Apr 2006 10:51:13 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web31811.mail.mud.yahoo.com (web31811.mail.mud.yahoo.com [68.142.207.74]) by postgresql.org (Postfix) with SMTP id 70EAE11F6C3E for ; Thu, 13 Apr 2006 10:51:10 -0300 (ADT) Received: (qmail 78792 invoked by uid 60001); 13 Apr 2006 13:51:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=J8NSA0Z0F3uIsU6N65DKS//diheCmmSSXi7AIktVIr+L6QC55uI5oe1CgOdx8tOWuRl4sMVCsKfYO8jHNQVT8jivjljQfjSokbj7gIE4uZjkiWqdDMKRQC1FhZyW/cpDBlbZGvB+0tCgOzMtUlynAlKx86xMakr6s4uJi1U34DA= ; Message-ID: <20060413135111.78790.qmail@web31811.mail.mud.yahoo.com> Received: from [63.203.180.122] by web31811.mail.mud.yahoo.com via HTTP; Thu, 13 Apr 2006 06:51:11 PDT Date: Thu, 13 Apr 2006 06:51:11 -0700 (PDT) From: Richard Broersma Jr Subject: Re: how to solve this problem To: marchesini@unipg.it, pgsql-sql@postgresql.org In-Reply-To: <1144934290.5079.32.camel@geologia5.agora.ing.unipg.it> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200604/89 X-Sequence-Number: 24898 Just a thought, Could you achieve that same result using the binary representation of an integer? Regards, Richard --- ivan marchesini wrote: > 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 > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >