thank you for your reply, I use IGNORE, I am copying data from production to staging, and during this process, sometimes data will already be in staging and INSERT IGNORE will then not give me a duplicate key error. I will review and try to implement your code, it makes, sense.