Magento – Select all values of an attribute by using SQL

It is useful to be able to export lists of brands, whether you just need a quick list directly from PHPMyAdmin, or you need to pull this information into 3rd party app.

To get all the attribute values for an attribute called brands, you can run the following query

SELECT EAOV.VALUE
FROM eav_attribute EA
LEFT JOIN eav_attribute_option EAO ON EAO.ATTRIBUTE_ID = EA.ATTRIBUTE_ID
LEFT JOIN eav_attribute_option_value EAOV ON EAOV.OPTION_ID = EAO.OPTION_ID
WHERE EA.ATTRIBUTE_CODE = ‘BRANDS’
AND EAOV.STORE_ID = 0

Revisions

No comments yet.

Leave a Reply