Re: [despammed] sql can i substitute

From: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>
To: Andreas Kretschmer <akretschmer(at)despammed(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [despammed] sql can i substitute
Date: 2004-12-17 12:18:15
Message-ID: 0412171748151J.06834@thenilgiris.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2004-12-17 12:24:45 Re: [despammed] sql can i substitute
Previous Message Andreas Kretschmer 2004-12-17 11:45:33 Re: [despammed] sql can i substitute