Said Ramirez wrote:
I think you are more after something like
SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar.
-Said
An even simpler way to do this is using the COALESCE function:
http://www.postgresql.org/docs/current/interactive/functions-conditional.html
SELECT COALESCE(foo, 'NA') AS foo FROM bar;
will either return the value in the field(s) "foo" or 'NA' if it is
NULL. Keep in mind that you can't mix data types, like 'NaN'::text and
32.3::float in the result.
-Mike
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general