VPS business hosting starting at $29.95/24/7 premium technical support

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry Magento 2

SELECT u.value_id,u2.value_id, u.attribute_id, u.entity_id, u.value
FROM catalog_product_entity_int u, catalog_product_entity_int u2
WHERE u.entity_id = u2.entity_id AND u.attribute_id = u2.attribute_id AND u.value= u2.value and u.value_id<u2.value_id


DELETE FROM catalog_product_entity_int
WHERE value_id IN (
    SELECT u.value_id as value_id
FROM catalog_product_entity_int u, catalog_product_entity_int u2
WHERE u.entity_id = u2.entity_id AND u.attribute_id = u2.attribute_id AND u.value= u2.value and u.store_id=u2.store_id and u.value_id<u2.value_id
    )

Author: Harshvardhan Malpani

PHP Developer based in New Delhi, India. Working as a freelance web developer providing server deployment, website development and maintenance services.

Leave a Reply

Your email address will not be published. Required fields are marked *