From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | novnov <novnovice(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: IF function? |
Date: | 2007-05-01 15:37:50 |
Message-ID: | 827E6F59-5E51-4B6A-8D2C-7C2F91371895@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On May 1, 2007, at 12:57 AM, David Fetter wrote:
> On Mon, Apr 30, 2007 at 10:51:36PM -0700, novnov wrote:
>>
>> Does postgresql have a built in IF function that allows one to eval a
>> condition and return one or another value? Like:
>>
>> IIF(mybooleanfield = true, "It's true", "It's not true")
>
> It has CASE, as in
>
> CASE foo WHEN true THEN 'It''s true' ELSE 'It''s not true' END;
>
Or, for simple binary conditions like that:
CASE WHEN foo is TRUE
THEN "it's true"
ELSE "it's not true"
END
erik jones <erik(at)myemma(dot)com>
software developer
615-296-0838
emma(r)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-05-01 16:02:55 | Re: dump-restore only one table |
Previous Message | Jan Bilek | 2007-05-01 15:36:00 | PostgreSql replication and load balancing ( is Slony-I a solution?) |