Conditional on Select List

Поиск
Список
Период
Сортировка
От Fernando
Тема Conditional on Select List
Дата
Msg-id 4829B938.1060805@ggtours.ca
обсуждение исходный текст
Ответы Re: Conditional on Select List  ("Harald Armin Massa" <haraldarminmassa@gmail.com>)
Re: Conditional on Select List  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Conditional on Select List  (Sam Mason <sam@samason.me.uk>)
Re: Conditional on Select List  ("Adam Rich" <adam.r@sbcglobal.net>)
Re: Conditional on Select List  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Conditional on Select List  ("Douglas McNaught" <doug@mcnaught.org>)
Re: Conditional on Select List  ("Richard Broersma" <richard.broersma@gmail.com>)
Список pgsql-general
Is it possible to do this?

SELECT IF(COUNT(colname) > 0, TRUE, FALSE) AS colname FROM table;

What I want is to return a boolean, but when I tried SELECT COUNT(colname)::BOOLEAN FROM table; it says it cannot cast bigint to boolean.

Is there such IF function or do I have to create my own.

Thank you.

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

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: PG -v- MySQL
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_standby / WAL archive-restore through system restarts