Skip to content

Magento2 : Sql query to get product attribute value

select
	a.*,
	mapping_id.value as attribute_value
from 
	catalog_product_entity as a,
	catalog_product_entity_varchar as attribute_table
where
   attribute_table.entity_id = a.entity_id and
   attribute_table.attribute_id = (select attribute_id from eav_attribute where attribute_code = 'attribute_code' limit 1 ) and
   attribute_table.value is null

/*
table catalog_product_entity_varchar correspondence to your attribute type, 
if the attribute type is integer use catalog_product_entity_int
*/

 

Comments are closed.