> > 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); > > This particular query need not be very inefficient if the pages needed > to do the second sub-query are left in the cache from the first sub- > query...
No. That's true. But this is just a simple example. It's possible that the sub-select is much more complicated. By the way, the syntax diagram doesn't allow "+=" so how would the above be coded in reality? This way? UPDATE t1 SET a = (SELECT t1.a + t2.a FROM t2 WHERE t1.id = t2.id), b = (SELECT t1.b + t2.b FROM t2 WHERE t1.id = t2.id) Or... UPDATE t1 SET a = t1.a + (SELECT t2.a FROM t2 WHERE t1.id = t2.id), b = t1.b + (SELECT t2.b FROM t2 WHERE t1.id = t2.id) Marc _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users