Paul Sanderson <sandersonforens...@gmail.com> wrote: > I have two tables and I want to copy (occasionally) a few thousand > columns that have been added to table1 into table2, both tables have > the same unique key but otherwise the columns are different. > > table2 will be initially populated from table1 using > > INSERT into table table2 SELECT refno from table1 WHERE flag > 0 > > I could drop table2 and then do the above but will then obviously lose > any data that has been modified in table2. How can I just append the > new rows from table1 into table2
If refno is a primary key in table2, or has a unique constraint on it, you can do insert or ignore into table2(refno) select refno from table1; "or ingore" part instructs SQLite to skip over all rows that would cause uniqueness conflict if inserted. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users