I have a script in PHP and MySQL that looks in the client table for all clients that have not yet been imported to another bank / table and it imports.
In the customer table, you have flag imported
with values (0 or 1).
I make a select in it and import it into another table bank.
After that, in the same database that has the customer table, there is a table of logs where the email that was imported and the date is inserted.
But sometimes it puts duplicate logs as if it had been imported twice.
I do not want it to take the risk of importing or actually entering twice the same log.
You may ask, ah, just put the email field as unique.
I can not do this, because my system sometimes inserts other types of email client logs, so it would be a problem.
What would be the best solution for this?