- Are the IDs of
new_table and uploaded_tmp the same? If not, remove them from the INSERT statement
- Do you need the ID to be the same after the update? If not see the answer of David162795.
- If you don't want your
PRIMARY ID to change you have to use INSERT INTO ... ON DUPLICATE KEY UPDATE. But then we must know your UNIQUE indices
In this example there is a PRIMARY key (ID) and a UNIQUE index (last_name, first_name)
INSERT INTO new_table (
last_name,
first_name,
val1,
val2,
...
)
SELECT
last_name,
first_name,
val1,
val2,
FROM uploaded_tmp
ON DUPLICATE KEY UPDATE
val1 = VALUES(val1),
val2 = VALUES(val2)