Hi all, I want to update a field (f1) in a table with new data in some rows while preserving data in the rest of the rows.
The way I am currently doing this is: (1) Add new data into a temporary table (t2). A unique numeric identifier is stored in the field named "row" that corresponds to each value that I want to update. (2) Update the old table (t1) using this expression: UPDATE OR REPLACE t1 SET f1 = (SELECT f1 FROM t2 WHERE t2.row = t1.row) WHERE t1.row IN (SELECT row FROM t2) (3) Drop the temporary table (t2). t1 before: row f1 1 foo1 2 bar3 3 foo2 temporary t2: row f1 2 hello t1 after: row f1 1 foo1 2 hello 3 foo2 I know this is probably not a good way of doing this operation. I have tried using other methods (joins) but often I end up just replacing the whole data field and not only the rows shared by t1 and t2. This method works well until the number of rows becomes very large and the operation slows down considerably. Any help would be appreciated. Thanks!, Erik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users