Re: Conditional on Select List - Mailing list pgsql-general

From Adam Rich
Subject Re: Conditional on Select List
Date
Msg-id 008201c8b513$663d2b30$32b78190$@r@sbcglobal.net
Whole thread Raw
In response to Conditional on Select List  (Fernando <fernando@ggtours.ca>)
List 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.
>

How about this?  Logic
al expresses are already returned as Boolean.

Select COUNT(colname) > 0 AS colname FROM table



pgsql-general by date:

Previous
From: Sam Mason
Date:
Subject: Re: Conditional on Select List
Next
From: Tom Lane
Date:
Subject: Re: Conditional on Select List