Re: SQL subquery question - Mailing list pgsql-general

From Rick Schumeyer
Subject Re: SQL subquery question
Date
Msg-id 455B1E1B.1000505@ieee.org
Whole thread Raw
In response to Re: SQL subquery question  (Alban Hertroys <alban@magproductions.nl>)
List 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;
>
>

pgsql-general by date:

Previous
From: Matthias.Pitzl@izb.de
Date:
Subject: Question about query optimization
Next
From: Shelby Cain
Date:
Subject: Re: PG_MODULE_MAGIC check in 8.2