Answers for "duplicate entry for key"

0

duplicate entry for key

The error says it all:

Duplicate entry '' 
So run the following query:

SELECT unique_id,COUNT(unique_id)
FROM yourtblname
GROUP BY unique_id
HAVING COUNT(unique_id) >1
This query will also show you the problem

SELECT *
FROM yourtblname
WHERE unique_id=''
This will show you where there are values that have duplicates. You are trying to create a unique index on a field with duplicates. You will need to resolve the duplicate data first then add the index
Posted by: Guest on March-16-2021

Code answers related to "duplicate entry for key"

Browse Popular Code Answers by Language