On Mar 26, 2012, at 12:03 PM, Wu Jian wrote: > The only way I know to achieve this is write several SQL strings like this: > SELECT id FROM this_table WHERE id > 2; > foreach (_id in selection) > UPDATE this_table SET data='abc' WHERE id=_id
Along these lines, you could do it in just two statements: (1) First, select you affected set of rows and their new values: create temporary table changeset as select rowid as target_rowid, 'bar' as new_data from foo where /* ; In other words, records all the affected rowids and their column new values. (2) Apply the change set: update foo set data = ( select new_date from changeset where foo.rowid = changeset. target_rowid ) where rowid in ( select target_rowid from changeset ); (3) Do whatever you want to do with the change set _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users