If you have custom attributes named the same across multiple products, you
wish to remove said attributes, this might come in useful. The SQL below restricts
the removal of the attributes to a certain attribute set name, but you can remove
this is you want to remove custom options from all attribute sets:
DELETE o
FROM catalog_product_option o
INNER JOIN catalog_product_option_title t ON o.option_id = t.option_id
INNER JOIN catalog_product_entity p ON o.product_id = p.entity_id
INNER JOIN eav_attribute_set a ON p.attribute_set_id = a.attribute_set_id
WHERE t.title IN (
'Option 1',
'Option 2',
'Option 3',
'Option 4',
)
AND a.attribute_set_name = 'Attribute set name';
Posted by Mike Whitby to Magento (2014-02-06 14:50)