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 7DDC13CCCDF for ; Fri, 17 Dec 2004 14:44:10 +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 96496-03 for ; Fri, 17 Dec 2004 14:44:03 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id A423D3CC87F for ; Fri, 17 Dec 2004 14:44:04 +0000 (GMT) Received: (qmail 22603 invoked by uid 500); 17 Dec 2004 14:56:53 -0000 Date: Fri, 17 Dec 2004 08:56:53 -0600 From: Bruno Wolff III To: Kenneth Gonsalves Cc: pgsql-sql@postgresql.org Subject: Re: sql can i substitute Message-ID: <20041217145653.GB21935@wolff.to> Mail-Followup-To: Kenneth Gonsalves , pgsql-sql@postgresql.org References: <0412171655451H.06834@thenilgiris.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0412171655451H.06834@thenilgiris.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/125 X-Sequence-Number: 19745 On Fri, Dec 17, 2004 at 16:55:45 +0530, Kenneth Gonsalves wrote: > hi > > table: > > name varchar(10) > fruit integer > > i want to write an sql statement like this: > > select fruit from table > > which should return 'good' if fruit = 1 and 'bad' if fruit =2 and 'rotten' if > fruit =3 > > can it be done? Yes; use a CASE statement.