0

I want to get all simple products and in addition, I want to get an attribute called title_name for those products. The attribute_id (from eav_attribute) of the attribute is 450.

This is what I got so far:

SELECT * FROM catalog_product_entity WHERE type_id = 'simple';

Now I need the join with the attribute and this is where I am struggling. How can I do that?

Magento 1.9

1

You can use below MySQL query to get the required records from the database

SELECT 
    `e`.`sku` as SKU , `e`.`entity_id` as 'Entity ID', `attribute_table`.`attribute_id` as 'Attribute ID',  `attribute_table`.`value` as 'Value'
FROM
    `catalog_product_entity` AS `e`
     INNER JOIN
    `catalog_product_entity_varchar` AS `attribute_table` ON (`attribute_table`.`entity_id` = `e`.`entity_id`)
WHERE
    `attribute_table`.`attribute_id` = 450 AND `e`.`type_id` = 'simple';

Hope this helps!!!

  • Yes, but there is no attribute_id column in catalog_product_entity? Did you mean attribute_table.attribute_id = 450? – Arnie Sep 9 at 8:01
  • I've updated my answer, please check it again. – Sumit Sep 9 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.