Re: update help

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Carolyn Lu Wong <carolyn(at)greatpacific(dot)com(dot)au>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: update help
Date: 2001-01-18 04:18:57
Message-ID: 23145.979791537@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Carolyn Lu Wong <carolyn(at)greatpacific(dot)com(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-01-18 05:54:48 One Question Answered
Previous Message Josh Berkus 2001-01-18 04:04:45 Re: update help