Magento 2.Remove attributes that are not in attribute set
DELETE FROM catalog_product_entity_int atr
WHERE atr.attribute_id NOT IN (
SELECT attribute_id
FROM eav_entity_attribute a
WHERE a.attribute_set_id = (
SELECT attribute_set_id
FROM catalog_product_entity e
WHERE e.entity_id = atr.entity_id
)
);
Repeat this query for all attribute type tables.
All attribute type queries can be selected using following query:
SELECT concat('catalog_product_entity_', backend_type)
FROM eav_attribute
WHERE backend_type != 'static'
GROUP BY backend_type;
Can anybody advice how to perform this foreach in one query?
Written by sivaschenko
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Magento 2
Authors
sivaschenko
19.23K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#