On Thu, Aug 5, 2010 at 01:17, Igor Tandetnik itandet...@mvps.org wrote:
Or, if t1.ID is a primary key or otherwise has a unique constraint:
insert or replace into t1(ID, name)
select ID, name from t2;
this one is different because it would cause INSERTs into t1 if some
ID exists in t2 and
Igor Tandetnik wrote:
Dominique Pellé dominique.pe...@gmail.com wrote:
For example, given 2 tables t1 and t2, both with 2 columns as follows...
Table t1:
ID name
--
1
2 NULL
3 NULL
4
(~1 million records)
Table t2:
ID name
2010/8/5 Dominique Pellé dominique.pe...@gmail.com:
Using information in previous reply, I can do it with 2 UPDATE queries
as follows (but I suspect that there is a better solution).
UPDATE t1 SET l_nm = (SELECT l_nm FROM t2 WHERE t1.ID_PK = t2.ID_FK)
WHERE ID_PK IN (SELECT ID_FK FROM t2);
Hi
I'm new to SQLite and I'm still learning. It's unclear to me how to update
many records efficiently in a table.
For example, given 2 tables t1 and t2, both with 2 columns as follows...
Table t1:
ID name
--
1
2NULL
3NULL
4
(~1
Dominique Pellé dominique.pe...@gmail.com wrote:
For example, given 2 tables t1 and t2, both with 2 columns as follows...
Table t1:
ID name
--
1
2NULL
3NULL
4
(~1 million records)
Table t2:
ID name
--
2