Re: sql can i substitute - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: sql can i substitute
Date
Msg-id 20041217145653.GB21935@wolff.to
Whole thread Raw
In response to sql can i substitute  (Kenneth Gonsalves <lawgon@thenilgiris.com>)
List pgsql-sql
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.


pgsql-sql by date:

Previous
From: Marcus Claesson
Date:
Subject: Re: can't get the order I want after inserting new rows
Next
From: Bruno Wolff III
Date:
Subject: Re: sql can i substitute