Skip to content

Instantly share code, notes, and snippets.

@jkpr
Created July 3, 2017 15:58
Show Gist options
  • Save jkpr/204f5f5318080ae5962d8272cce1eea4 to your computer and use it in GitHub Desktop.
Save jkpr/204f5f5318080ae5962d8272cce1eea4 to your computer and use it in GitHub Desktop.
SQLite merge table of one database into table of another
$ sqlite3 db1.sqlite
> ATTACH '/path/to/db2.sqlite' AS mergeme;
> BEGIN;
> INSERT INTO photos SELECT * FROM mergeme.photos WHERE mergeme.photos.orig_md5 NOT IN (SELECT orig_md5 FROM photos);
> COMMIT;
> DETACH mergeme;
@GGontijo
Copy link

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment