Re: 3 tables join update

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: 3 tables join update
Дата
Msg-id 355878.78114.qm@web31802.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на 3 tables join update  (rihad <rihad@mail.ru>)
Ответы Re: 3 tables join update
Re: 3 tables join update
Список pgsql-general
--- rihad <rihad@mail.ru> wrote:
> UPDATE Foo foo
> SET foo.baz_id=baz.id
> FROM Baz baz LEFT JOIN Bar bar ON (foo.bar_id=bar.id)
> WHERE bar.id IS NULL;

This query cannot work.  Basiclly, you are trying to set the foo.baz_id = baz.id for records in
foo that do not yet exist.  Doing this is impossible.

For this to work, you should be using an INSERT query to _ADD_ records to foo that do not yet
exist.

Regards,
Richard Broersma Jr.



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

Предыдущее
От: rihad
Дата:
Сообщение: 3 tables join update
Следующее
От: "CN"
Дата:
Сообщение: Re: Please change default characterset for database cluster