dimanche 3 juillet 2016

ignore duplicate on insert

I got 2 tables :

CREATE TABLE
p(id_p INT AUTO_INCREMENT PRIMARY KEY,
name_p VARCHAR(50),
surname_p VARCHAR(50) 
UNIQUE (name_p,surname_p);

and

CREATE TABLE
t_int(name_int VARCHAR(40),
surname_int VARCHAR(40),
name_m VARCHAR(40),
surname_m VARCHAR(40),
cab VARCHAR(50));

I need to move name_int and surname_int into p table on name_p and surname_p.

My problem is this: I can't make an unique index for the name_p and surname_p combination, and on insert I get duplicate error(there are 300k entries). Since I need all of them inserted what should I do? Insert ignore is not a valid option for me since it is not going to insert them all.

I really need help. Thank you.

Aucun commentaire:

Enregistrer un commentaire