Re: [despammed] sql can i substitute

From: Andreas Kretschmer <akretschmer(at)despammed(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [despammed] sql can i substitute
Date: 2004-12-17 12:24:45
Message-ID: 20041217122445.GA19602@Pinguin.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

am 17.12.2004, um 17:48:15 +0530 mailte Kenneth Gonsalves folgendes:
>
> 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'?

Yes, simple:

test=# select name, case
test-# when fruit = 1 then 'good'
test-# when fruit = 2 then 'bad'
test-# when fruit = 3 then 'rotten' end as fruit from fruit;
name | fruit
--------+--------
Apple | good
Banana | bad
Cherry | rotten
(3 Zeilen)

Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Tel. NL Heynitz: 035242/47212
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2004-12-17 12:37:05 Re: can't get the order I want after inserting new rows
Previous Message Kenneth Gonsalves 2004-12-17 12:18:15 Re: [despammed] sql can i substitute