Re: IF function?

From: David Fetter <david(at)fetter(dot)org>
To: novnov <novnovice(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: IF function?
Date: 2007-05-01 05:57:31
Message-ID: 20070501055731.GC28003@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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;

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!
Consider donating to PostgreSQL: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harpreet Dhaliwal 2007-05-01 05:59:16 Re: IF function?
Previous Message novnov 2007-05-01 05:51:36 IF function?