"Gilles Ganault" <[email protected]> wrote in message news:[email protected] > On Fri, 13 Mar 2009 09:52:25 -0400, "Igor Tandetnik" > <[email protected]> wrote: > Thank you Igor for the help. Before I give it a shot, I need to speciy > those requirements: > 1. The tables live in two SQLite database files, so I must open both > in the same client session
http://sqlite.org/lang_attach.html > 2. Each table may contain one or more records of the same company > > The goal is to create a third, new database file where companies are > unique, ie. a single record for each company. .open new.db ATTACH 'old1.db' as old1; ATTACH 'old2.db' as old2; create table companies(...); insert into companies select * from old1.companies where rowid in (select min(rowid) from old1.companies group by company); insert into companies select * from old2.companies where rowid in (select min(rowid) from old2.companies where company not in (select company from companies) group by company); Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

