Re: update help

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: update help
Дата
Msg-id 23145.979791537@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: update help  (Carolyn Lu Wong <carolyn@greatpacific.com.au>)
Список pgsql-sql
Carolyn Lu Wong <carolyn@greatpacific.com.au> writes:
> Forgot to mention that I'm using V6.5.

Oh.  6.5's support for sub-selects is pretty limited :-(.
I think the only way to do it in 6.5 is with a temp table,
eg

SELECT id, sum(amount) as sum into temp table tt from t2 group by id;

update t1 set amount = tt.sum where id = tt.id;

drop table tt;

You might wanna think about updating sometime soon...
        regards, tom lane


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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: update help
Следующее
От: "Josh Berkus"
Дата:
Сообщение: One Question Answered