Re: Conditional on Select List

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fernando <fernando(at)ggtours(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Conditional on Select List
Date: 2008-05-13 16:07:37
Message-ID: 26817.1210694857@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fernando <fernando(at)ggtours(dot)ca> writes:
> Is it possible to do this?
> SELECT IF(COUNT(colname) > 0, TRUE, FALSE) AS colname FROM table;

SELECT COUNT(colname) > 0 AS colname FROM table;

If you really like to type, you could use a CASE expression.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Hunter 2008-05-13 16:09:28 Re: PG -v- MySQL
Previous Message Adam Rich 2008-05-13 16:07:09 Re: Conditional on Select List