Re: IF function?

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: IF function?
Дата
Msg-id 46375322.80907@iol.ie
обсуждение исходный текст
Ответ на Re: IF function?  (novnov <novnovice@gmail.com>)
Список pgsql-general
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@iol.ie
---------------------------------------------------------------

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: dump-restore only one table
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: pgsql and Mac OS X