Search Postgresql Archives

Conditional on Select List

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

 



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.

[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