Re: [GENERAL] SQL subquery question

2006-11-15 Thread Rick Schumeyer
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 stat

Re: [GENERAL] SQL subquery question

2006-11-15 Thread Alban Hertroys
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; -- Alban Hertroys [EMAIL PROTECTED] magproductions b.v. T: ++31(0)5

[GENERAL] SQL subquery question

2006-11-15 Thread Rick Schumeyer
I think this can be done with one SQL statement, but I'm not sure. I have two tables: table t contains key k, another field f, and a bunch of other stuff. In a poor design decision, table tsubset contains a small number of "pointers" to t. I should have used the k column; instead I used the