Jump to content

Avoid insert duplicate emails when importing from CSV file


lopes_andre

Recommended Posts

Hi, I need to insert to my email database new emails in CSV format, but I don't want to import duplicate emails.

 

 

Table Scheme:

 

id | email  (unique) | name

---------------------------

1 | [email protected] | expl1

2 | [email protected] | expl2

3 | [email protected] | expl3

4 | [email protected] | expl4

 

How can I import to this database new emails without insert duplicate emails?

 

The function LOAD DATA INFILE can do this, avoiding to insert duplicate emails in the UNIQUE field "email"?

 

Best Regards, André.

Hi,

 

Thanks for your reply.

 

I don't explain me well. The email field is "unique", but I need to import data to this database and I know that some emails that I will import are duplicated, but because the field email is "unique" I think the import will stop with an error every time that one duplicate email is inserted(or tried to insert).

 

What I need to know is... there is some way do to this:

 

"if email allready in database, ignore that email and continue importing".

 

There is a way to do this, some mysql function?

 

Best Regards, André.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.