Обсуждение: immediate if function

Поиск
Список
Период
Сортировка

immediate if function

От
Дата:
I have been through the list of functions offered by Postgres and I cannot
find an immediate if function.  Is there one available?  Or perhaps, is
there a better way to do this:

I have a date field, and if the status is X then I want to return the date,
otherwise I want to return a null.  Any ideas?

Terry Fielder
Manager Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com



Re: immediate if function

От
Neil Conway
Дата:
On Thu, 2003-02-06 at 22:55, terry@ashtonwoodshomes.com wrote:
> I have a date field, and if the status is X then I want to return the date,
> otherwise I want to return a null.  Any ideas?

CASE should work:

http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/functions-conditional.html

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC