/* * Recover the old entries in the archive table * This is safe because none of the entries in the old table exist in the current * (which is exactly the problem we're trying to solve) * Also, the old table can't have any entries that the current has */ insert into ArchWiki.archive select * from OldTempArchWiki.archive; /* * Recover the old entries in the text table * This query only inserts the entries that don't exist in the current table * Note the dummy 'ArchWiki.text.old_id=ArchWiki.text.old_id' as the update operation * http://stackoverflow.com/questions/1361340/how-to-insert-if-not-exists-in-mysql */ insert into ArchWiki.text select * from OldTempArchWiki.text on duplicate key update ArchWiki.text.old_id=ArchWiki.text.old_id;