So, basically I have this code below to change the date format from CSV, so it can be recognized by MySQL when I import it.
LOAD DATA INFILE 'file.csv'
INTO TABLE customer FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n'
(
ID, name, @var1, age
)
SET date = STR_TO_DATE(@var1, '%d/%m/%Y')
Now, consider the ID is the PRIMARY key. I get an update on my file.csv and I want to re-load it to MySQL by running my code again. Instead only update the new record, it give me this error message:
#1062 - Duplicate entry '05' for key 'PRIMARY'
Is there any way to ignore the same ID and only add the new record with different ID?