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 <[EMAIL PROTECTED]>
software developer
615-296-0838
emma(r)




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to