pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Kenneth Gonsalves <lawgon@thenilgiris.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: sql can i substitute
Date: Fri, 17 Dec 2004 08:56:53 -0600
Message-ID: <20041217145653.GB21935@wolff.to> (raw)
In-Reply-To: <0412171655451H.06834@thenilgiris.com>
References: <0412171655451H.06834@thenilgiris.com>

On Fri, Dec 17, 2004 at 16:55:45 +0530,
  Kenneth Gonsalves <lawgon@thenilgiris.com> 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.



view thread (10+ messages)  latest in thread

Message-ID: <20041217145653.GB21935@wolff.to>
Permalink:  ../20041217145653.GB21935@wolff.to/
Also on:    postgresql.org/message-id/20041217145653.GB21935@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, lawgon@thenilgiris.com
  Subject: Re: sql can i substitute
  In-Reply-To: <20041217145653.GB21935@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox