How can i get the following fields using sql query entity_id, sku , Brand where brand is custom drop-down attribute.
1 Answer
I had created the following query which works for me, may be gave some help to any one:
SELECT
`e`.`sku` as Sku ,`e`.`entity_id` as Code,`option_value`.`value` as manufacturer
FROM
`catalog_product_entity` AS `e`
INNER JOIN
`catalog_product_entity_int` AS `at_manufacturer` ON (`at_manufacturer`.`entity_id` = `e`.`entity_id`)
INNER JOIN
`eav_attribute_option_value` AS `option_value` on (`at_manufacturer`.`value`=`option_value`.`option_id`)
AND (`at_manufacturer`.`attribute_id` = '81')
AND (`at_manufacturer`.`store_id` = 0)
AND (`option_value`.`store_id` = 0)
WHERE
(at_manufacturer.value != 'null')
you can change 81 with your respective Attr id.