X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BFBE63CC814 for ; Fri, 17 Dec 2004 12:19:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33735-01 for ; Fri, 17 Dec 2004 12:18:58 +0000 (GMT) Received: from sharp.noc24x7.com (unknown [69.56.128.138]) by svr1.postgresql.org (Postfix) with ESMTP id 34C4B3CC7FF for ; Fri, 17 Dec 2004 12:19:00 +0000 (GMT) Received: from [61.3.110.149] (helo=thenilgiris.com) by sharp.noc24x7.com with esmtpa (Exim 4.43) id 1CfH4V-0002T7-9K; Fri, 17 Dec 2004 17:49:00 +0530 Received: from localhost (localhost [[UNIX: localhost]]) by thenilgiris.com (8.11.2/8.11.2) id iBHCIF431458; Fri, 17 Dec 2004 17:48:15 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Kenneth Gonsalves To: Andreas Kretschmer , pgsql-sql@postgresql.org Subject: Re: [despammed] sql can i substitute Date: Fri, 17 Dec 2004 17:48:15 +0530 X-Mailer: KMail [version 1.2] References: <0412171655451H.06834@thenilgiris.com> <20041217114533.GA17038@Pinguin.wug-glas.de> In-Reply-To: <20041217114533.GA17038@Pinguin.wug-glas.de> MIME-Version: 1.0 Message-Id: <0412171748151J.06834@thenilgiris.com> Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sharp.noc24x7.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - thenilgiris.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.221 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/117 X-Sequence-Number: 19737 On Friday 17 December 2004 05:15 pm, Andreas Kretschmer wrote: > test=# select * from fruit; > name | fruit > --------+------- > Apple | 1 > Banana | 2 > Cherry | 3 > (3 Zeilen) > > > test=# select name, fruit, case > test-# when fruit = 1 then 'good' > test-# when fruit = 2 then 'bad' > test-# when fruit = 3 then 'rotten' end from fruit; > name | fruit | case > --------+-------+-------- > Apple | 1 | good > Banana | 2 | bad > Cherry | 3 | rotten > (3 Zeilen) thanks - opened up a whole new world for me. One more thing, the values come under the column 'case', can i avoid having the column 'case' and get the 'good', 'bad' and 'rotten' under the column 'fruit'? kg