Answers for "Duplicate key name"

SQL
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
0

Duplicate key name 'fk_

SELECT U.*, UP.name
FROM units U
LEFT JOIN units UP ON U.parent_id = UP.id
Posted by: Guest on December-27-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language