you can do: update t1 set (a,b)=(select a, b from t2 where t1.id=t2.id) just like oracle do....
--- On Thu, 3/8/12, Marc L. Allen <mlal...@outsitenetworks.com> wrote: > From: Marc L. Allen <mlal...@outsitenetworks.com> > Subject: [sqlite] How efficient is this? > To: "sqlite-users@sqlite.org" <sqlite-users@sqlite.org> > Date: Thursday, March 8, 2012, 12:53 PM > I'm trying to do a multi-column > update, adding values from another table. Something > like: > > UPDATE t1 SET a += (SELECT a FROM t2 WHERE t1.id = t2.id), > > b += > (SELECT b FROM t2 WHERE t1.id = t2.id); > > Note that both a and b are updated from the a and b of the > same record. (Or it's supposed to be that way, > ignoring any syntax errors from above.) > Does SQLite really do two lookups? Is there a more > efficient way of doing this? > > Thanks, > > Marc > > -- > ****************************************************************** > * > * > > * > * Marc L. Allen > * "... so many things are > * > * > * > possible just as long as you * > * Outsite Networks, Inc. * don't > know they're impossible." * > * (757) 853-3000 #215 > * > > * > * > * > > * > * mlal...@outsitenetworks.com > * -- The Phantom > Tollbooth * > * > * > > * > ****************************************************************** > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users