Using case expressions in update set clause

Поиск
Список
Период
Сортировка
От Chris Velevitch
Тема Using case expressions in update set clause
Дата
Msg-id b0a3bf780710142233rfe8f1e6ge9c49462a035f733@mail.gmail.com
обсуждение исходный текст
Ответы Re: Using case expressions in update set clause
Список pgsql-general
I just want to clarify that the following will always behave the way I
think it's supposed to behave:-

     update  tableA
     set       date_field = case when date_field is null then some_date
                                          else date_field end;

If the current value of date_field for the current record is null then
set the date_field with some_date value otherwise keep the current
value of date_field.

Note: in the actual situation there'll be other fields that will
always be updated in addition to this one field that needs to be
conditionally updated.


Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
m: 0415 469 095
www.flashdev.org.au

В списке pgsql-general по дате отправления:

Предыдущее
От: Ned Lilly
Дата:
Сообщение: Re: reporting tools
Следующее
От: Tomasz Ostrowski
Дата:
Сообщение: Re: RES: 8.2.4 selects make applications wait indefinitely