Welcome Guest, Not a member yet? Register   Sign In
duplicate entry error. How to catch?

(This post was last modified: 07-06-2021, 02:37 PM by richb201.)

I think I will let the code fill in all the duplicates and then when it is done remove the duplicates with
DELETE t1 FROM contacts t1
INNER JOIN contacts t2
t1.id < t2.id AND
t1.email = t2.email;

But this requires an autoincrment id.
I can use "id int NOT NULL PRIMARY KEY AUTO_INCREMENT" in my Create table.
But when I try to insert I get a duplicate key error. I have tried
INSERT INTO BC_PR_list_temp SELECT NULL,srat.taxyear , srat.employee_email , etc
But I get this:
Error Number: 1062

Duplicate entry '1' for key 'BC_PR_list_temp.PRIMARY'

Any ideas how to get the insert to work? I need the id in order to use the code above.
proof that an old dog can learn new tricks

Messages In This Thread
RE: duplicate entry error. How to catch? - by richb201 - 07-06-2021, 02:36 PM

Theme © iAndrew 2016 - Forum software by © MyBB