Create an AUTO_INCREMENT field in the new table and omit it from the list of values:
CREATE TABLE NEW_TABLE (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, col1 …, col2 …, …); INSERT INTO new_table (col1, col2, …) SELECT col1, col2 FROM old_table_1 UNION ALL SELECT col1, col2 FROM old_table_2 UNION ALL …
source share