Re: sql can i substitute

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sql can i substitute
Date: 2004-12-17 14:56:53
Message-ID: 20041217145653.GB21935@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-12-17 15:01:00 Re: sql can i substitute
Previous Message Marcus Claesson 2004-12-17 14:32:31 Re: can't get the order I want after inserting new rows