0

I want to get disabled products id's and products price in magento 2 by using SQL Query ?

By using this i'm getting disabled product but how to get price for that products.

SELECT entity_id FROM `catalog_product_entity_int`
WHERE attribute_id = (
SELECT attribute_id FROM `eav_attribute`
WHERE `attribute_code` LIKE 'status'
) AND `catalog_product_entity_int`.value = 2
2

Try this:

SELECT entity_id, value as price from catalog_product_entity_decimal
WHERE entity_id IN (SELECT entity_id FROM `catalog_product_entity_int`
WHERE attribute_id = (
SELECT attribute_id FROM `eav_attribute`
WHERE `attribute_code` LIKE 'status'
) AND `catalog_product_entity_int`.value = 2) AND attribute_id = 77;
  • Thanks for your response but it gives an error on SQL " Error in query (1242): Subquery returns more than 1 row " @Natha – Prits Aug 23 '20 at 10:33
  • @Prits Edited. Fixed. please try the latest query now. – Natha Odedara Aug 23 '20 at 10:35
  • and let me know if it's working for you or not. – Natha Odedara Aug 23 '20 at 10:37
  • Yes it shows the result but showing the result i have attached screenshot in question showing two entity_id but the first one has the the actual price what is second row is fetched @Natha – Prits Aug 23 '20 at 10:40
  • do you have multiple stores? – Natha Odedara Aug 23 '20 at 10:44

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.