No announcement yet.

How To Combine Databases

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    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...


    • #3
      Thanks for the pointer, Crinos. I found <a href="http:[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;


      • #4
        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 :-)

        Gary (-;
        OBDGPSLogger, for logging OBDII and/or GPS data
        OBDSim, an OBDII/ELM327 software simulator
        mp3car forums: obdgpslogger, obdsim