Last Updated: May 27, 2016
·
810
· sivaschenko

Find unused eav attribute options in Magento 2

select eaov.value option_value from eav_attribute_option eao 
join eav_attribute_option_value eaov on eaov.option_id = eao.option_id
left join catalog_product_entity_int cpei on cpei.value = eao.option_id
where eao.attribute_id = (select ea.attribute_id from eav_attribute ea where ea.attribute_code = 'color')
and cpei.entity_id is null
group by eao.option_id;