On Tue, May 13, 2008 at 8:52 AM, Fernando <fernando(at)ggtours(dot)ca> wrote:
> SELECT IF(COUNT(colname) > 0, TRUE, FALSE) AS colname FROM table;
A rewrite of this query might do what you want:
SELECT colname_cnt > 0 AS Greaterthanzero
FROM ( SELECT COUNT( colname ) AS colname_cnt
FROM Table );
or
SELECT CASE COUNT( colname )
WHEN > 0
THEN TRUE
ELSE FALSE
END AS GreaterThanZero
FROM Table;
--
Regards,
Richard Broersma Jr.
Visit the Los Angles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug