Re: update help - Mailing list pgsql-sql

From Tom Lane
Subject Re: update help
Date
Msg-id 23145.979791537@sss.pgh.pa.us
Whole thread Raw
In response to Re: update help  (Carolyn Lu Wong <carolyn@greatpacific.com.au>)
List 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 by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: update help
Next
From: "Josh Berkus"
Date:
Subject: One Question Answered