On Thu, Mar 8, 2012 at 12:00 PM, Marc L. Allen <mlal...@outsitenetworks.com> wrote: >> 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.
Right, which is why I said "this particular query". And you're completely right to want something better. I think the simplest thing that could be done is to change the trigger sematincs of INSERT OR REPLACE to fire update triggers when the replacing row has the same rowid and/or primary key as the replaced row. > By the way, the syntax diagram doesn't allow "+=" so how would the above be > coded in reality? Oops, I missed that. > 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) UPDATE t1 SET a = a + <sub-select> ...; :) Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users