HI Ulrich, Sorry I should have made that clearer. I want to save all the data in one database, not just see it. Thanks for the idea though. Cheers, Dave
Ward Analytics Ltd - information in motion Tel: +44 (0) 118 9740191 Fax: +44 (0) 118 9740192 www: http://www.ward-analytics.com Registered office address: The Oriel, Sydenham Road, Guildford, Surrey, United Kingdom, GU1 3SR Registered company number: 3917021 Registered in England and Wales. -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Ulrich Goebel Sent: 10 November 2013 20:28 To: General Discussion of SQLite Database Subject: Re: [sqlite] Combining two databases into one May be there is a simple way depending of what means 'combine all the data'. If that means just _see_ all that data (without the oportunity to manipulate), there could be defined a VIEW which does a compound SELECT like CREATE VIEW combined_all as SELECT ... from db1.T1 UNION SELECT ... from db2.T1 UNION SELECT ... from db3.T1 ... Then it would not be necessary to insert the data from some databases into another 'from time to time', but you would have all the data 'just when you need it'. For details see http://www.sqlite.org/lang_select.html#compound Ulrich Am 10.11.2013 18:49, schrieb Dave Wellman: > Hi, > > > > I'm looking at a use case for SQLITE within one of our applications. > One potential scenario would be for multiple, asynchronous processes > to build their own database. Each one would be populating a different > table. At some point it would be 'really useful' to combine all the > data into a single SQLITE database. We'd still be using multiple tables. > > > > Obviously our application can open multiple databases, select all rows > from > T1 in one database and insert them into T1 in another database and > continue doing that until we're complete. I can't see any reason why > that shouldn't technically work and it will probably be fast enough > from a performance perspective. > > > > Is there a 'smart' way of doing this using built-in functaionality of > sqlite? I looked for a 'merge databases' command or something similar > but couldn't find anything. > > > > Ah! I may have just found the answer. If I've got databases db1 and > db2 attached, can I use something like 'insert into db1.t1 select * > from db2.t1;' (assuming that the 't1' definitions are the same !)? > > > > Cheers, > > Dave > > > > > > Ward Analytics Ltd - information in motion > > Tel: +44 (0) 118 9740191 > > Fax: +44 (0) 118 9740192 > > www: <http://www.ward-analytics.com> http://www.ward-analytics.com > > > > Registered office address: The Oriel, Sydenham Road, Guildford, > Surrey, United Kingdom, GU1 3SR > > Registered company number: 3917021 Registered in England and Wales. > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users