Reputation: 31
LOAD DATA LOCAL INFILE 'D:\\dummy data.txt' INTO TABLE mmc_avado.avado_mmc_file FIELDS TERMINATED BY '|'
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
I have this query to import date from text file to mysql. But I want....
Then how we perform this. Please help.
Upvotes: 2
Views: 3656
Reputation: 425823
You should import the data into a staging (possibly temporary) table then add the new data into the target table like this:
INSERT
INTO mmc_avado.avado_mmc_file
SELECT *
FROM staging_table
ON DUPLICATE KEY
UPDATE col1 = VALUES(col1),
col2 = VALUES(col2),
...
Upvotes: 1