Search Postgresql Archives

Re: IF function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/05/2007 15:38, novnov wrote:

I didn't express myself clearly. Is there an IIF type function one can use
inline in a view?
SELECT UserName, IIF(mybooleanfield = true, "It's true", "It's not true") as
SayIt FROM tblUser

That's what CASE is for:

select
  case
    when mybooleanfield then 'It''s true'
    else 'It''s not true'
  end as SayIt
from
  tblUser;

(...or something like that - look it up in the docs).

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@xxxxxx
---------------------------------------------------------------


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux