Re: SQL subquery question

From: Rick Schumeyer <rschumeyer(at)ieee(dot)org>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: pgsql mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL subquery question
Date: 2006-11-15 14:03:07
Message-ID: 455B1E1B.1000505@ieee.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for the suggestion...it needed only one small change:

update tsubset set k = t.k from t where t.f=tsubset.f;

Thanks!

Alban Hertroys wrote:
> Rick Schumeyer wrote:
>
>> foreach f in tsubset
>> update tsubset set k=(select k from t, tsubset where t.f=f);
>> end
>>
>> Can this be done with one SQL statement?
>>
>
> I think you mean
> update tsubset set k = t.k from t where t.f = f;
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shelby Cain 2006-11-15 14:21:24 Re: PG_MODULE_MAGIC check in 8.2
Previous Message Alban Hertroys 2006-11-15 13:47:00 Re: SQL subquery question