Friday, March 4, 2022

[FIXED] How can I import a table by adjusting the record IDs to the existing table?

Issue

By default, in phphmyadmin, when exporting a table, there is a string "DROP TABLE IF EXISTS table name;", which means that when importing an exported table, it will replace an existing one (i.e., it will erase the records and insert new ones).

I need to import additional data into an existing table.

But, as I said, the imported table completely replaces the existing one in the database.

And I need THE NEW TABLE TO COMPLEMENT THE "OLD" ONE.

I believe that if the "old" table has the last id=10, then the next id of the imported table will be -11.

(I import the mysqlfile)

Please tell me how to implement this?


Solution

I decided to do this:

  1. rename a table that already exists in the database
  2. importing a new table
  3. combine with UNION

You know the easiest way-write



Answered By - Леонид

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.