We have an attribute for some of our products that has hundreds of empty values. If you try to make and save any changes to any values, it kicks you back out to the dashboard and the changes are not saved. Is there a way to delete all empty values without deleting the entire attribute?
Over a year later and I am still dealing with this issue, I have tried using the query mentioned here: https://magento.stackexchange.com/a/16123/100539, but did not get any results. Does anyone have another query I can try or another method around this?
Okay, I figured it out. I couldn't find a single SQL command to do everything but this is the process I used to fix this.
go to the eav_attribute table of your database and find the attribute_id of the attribute with the empty values
go to the eav_attribute_option_value table and find the attribute options that you want to keep (I had 28 values I did not want to delete, if you have more, this may take some time). If you have multiple options with the same value, you can click on the option_id and see if it matches to the attribute_id from step 1 (at least in phpmyadmin)
once you have your list of option_ids, you can go to the eav_attribute_option table and search for all options with the attribute_id from step 1 (in my case, I had 5428 options), then you can use this command to find how many blank options you have:
SELECT * FROM eav_attribute_option WHERE attribute_id = [attribute_id from setp 1] AND option_id NOT IN (option_id list)
Verify that this is the data that you want to delete and run the following command:
DELETE FROM eav_attribute_option WHERE attribute_id = [attribute_id from setp 1] AND option_id NOT IN (option_id list)
This deleted the 5400 empty options that I had in my custom attribute. I hope this helps someone else.