I have a custom attribute called
PLU, and I want to select ALL product from the database with the
PLU VALUE in MySQL query, how can I do that?
eav_attribute Check ur
attribute_code for PLU & take
2] Depend on your attribute type (Text, Integer, Decimal, etc..), you can find in following tables
catalog_product_entity_datetime catalog_product_entity_decimal catalog_product_entity_int catalog_product_entity_text catalog_product_entity_varchar
Below is the query
SELECT * FROM catalog_product_entity_XXX WHERE attribute_id = '<Your Id>'.
entity_id is your Product Id
I assume you will loop through retrieved products at some point, so you can try to use magento2 style to retrieve them:
$productCollection->addAttributeToSelect('PLU') ->addAttributeToFilter('PLU',['notnull'=> true]);
I assumed you already have a $productCollection object added with dependency injection or with using object manager. While the above answer is also correct, I provided this one in case you need more info about each product found