Hi Pavel,
I need to transfer from another table because I am using an interface called
RSQLite. With this interface there is no easy method for creating a new field
in a currently existing table.
It sounds like it would be a quicker operation if the data were all in the same
table? Is there
Erik, I didn't quite understand what you wanted to say. Neither about
RSQLite and new field (it seems that you use the same field in both
tables), nor about having data in the same table. Could you please
elaborate?
Pavel
On Thu, Jun 24, 2010 at 11:37 AM, Erik Wright eswri...@wisc.edu wrote:
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
Erik Wright eswri...@... writes:
(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)
1. I dont think that WHERE t1.row IN (SELECT row FROM t2) is necessary
2. maybe you should do a
(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)
1. I dont think that WHERE t1.row IN (SELECT row FROM t2) is necessary
It is necessary. Otherwise all other rows will be updated