Re: "INNER JOIN .... USING " in an UPDATE
От | Richard Huxton |
---|---|
Тема | Re: "INNER JOIN .... USING " in an UPDATE |
Дата | |
Msg-id | 492276B5.1010609@archonet.com обсуждение исходный текст |
Ответ на | "INNER JOIN .... USING " in an UPDATE ("Webb Sprague" <webb.sprague@gmail.com>) |
Список | pgsql-general |
Webb Sprague wrote: > Hi all, > > (Version 3.5.5) I'd upgrade - version 3.5.5 doesn't actually exist :-) > I have tried to figure this out, but the docs, google, and my all > imagination fail me. I want to use a join clause with a "using list" > in an update statement. The following works, but it uses the WHERE > version of a join: > > update new_pivoted_table a set "2008-11-10" = b.data_stuff from > test_pivot b where a.id=b.id and a.id2=b.id2 and > date_ex='2008-11-10'; > UPDATE 3 > > The following doesn't work, to my chagrin: > > wsprague=# update new_pivoted_table a set "2008-11-10" = b.data_stuff > from test_pivot b join a using (id, id2) where date_ex='2008-11-10'; > ERROR: relation "a" does not exist I think you're out of luck. The UPDATE ... FROM bit is a PostgreSQL extension in itself, the standard way to do this would be: UPDATE t1 ... WHERE (id,id2) IN (SELECT id,id2 FROM t1 JOIN t2 USING ...) -- Richard Huxton Archonet Ltd
В списке pgsql-general по дате отправления: