Re: If function available?
| От | Josh Berkus |
|---|---|
| Тема | Re: If function available? |
| Дата | |
| Msg-id | web-510100@davinci.ethosmedia.com обсуждение исходный текст |
| Ответ на | If function available? (Francisco Reyes <lists@natserv.com>) |
| Ответы |
Re: If function available?
|
| Список | pgsql-novice |
Francisco,
> I tried it from the psql prompt and didn't work. Is there an IF or
> IIF function that can be used on a select query?
You want CASE, as in:
CASE WHEN field1 = 1 THEN NULL ELSE field1 END
See Postgresql.org --> Documentation --> SQL Commands --> SELECT for
more information, or consult your favorite SQL92 manual.
There are also several special functions for dealing with NULL output,
such as:
COALESCE(x,y,z) : returns first non-null value
NULLIF(x, y) : returns NULL if x = y
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
В списке pgsql-novice по дате отправления: