How To Combine Databases
I am on a lengthy trip doing trip logs. I ended up logging to two different obdlogger.db files. I can open them and poke around with sqlite3, but I don't know what steps I would take to combine the data from both databases into one, so I can generate a combined KML file. Can anyone help me with that?
Normaly you could merge them...
I have not plaeyed around enough with sqlite to know for a fact, but as long as they have the same structure, and date-time posting... you can even get it to merge cronologically :)
Tools to do it...
Thanks for the pointer, Crinos. I found <a href="http://www.mail-archive.com/[email protected]/msg12681.html">some instructions</a> after following your link. The gist of it is that you use the "attach" command to open the second database (that was the step I didn't understand previously) then just do
insert into obd select * from otherdb.obd;
insert into gps select * from otherdb.gps;
Inserting into trips required me to assign new TRIPIDs to the existing trips, so I did
update trip set tripid = 21 where tripid = 1;
update trip set tripid = 22 where tripid = 2;
and so on until they were done (I had eight trips). Then
insert into trip select * from otherdb.trip;
Other than trips, which use their own key, you should be able to literally catentate tables together. Be warned that if the databases are overlapping times, then Bad Things will happen.
I mean, sure, it's pretty unlikely for one guy with one car, but if you have a couple cars travelling in convoy and both logging, don't try to join those logs :-)