Skip to content

Instantly share code, notes, and snippets.

@BrocksiNet
Last active February 10, 2020 19:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BrocksiNet/275c1c6dcd2d1fca88dfc927e1e0fba2 to your computer and use it in GitHub Desktop.
Save BrocksiNet/275c1c6dcd2d1fca88dfc927e1e0fba2 to your computer and use it in GitHub Desktop.
Magento2 - MySQL Select simples products not assigned to parents
SELECT * FROM `catalog_product_entity`
LEFT JOIN `catalog_product_entity_int` ON `catalog_product_entity`.`entity_id` = `catalog_product_entity_int`.`entity_id`
WHERE `catalog_product_entity`.`type_id` = 'simple' AND `catalog_product_entity_int`.`attribute_id` = (SELECT `attribute_id` FROM `eav_attribute` WHERE `attribute_code` = 'visibility') AND `catalog_product_entity_int`.`value` = 1 AND `catalog_product_entity`.`entity_id` NOT IN
(
SELECT `product_id` FROM `catalog_product_super_link`
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment