Skip to content

Instantly share code, notes, and snippets.

@vishy93
Created February 26, 2019 14:43
Show Gist options
  • Save vishy93/69c1ae3737beadfa3201b538aa4e8323 to your computer and use it in GitHub Desktop.
Save vishy93/69c1ae3737beadfa3201b538aa4e8323 to your computer and use it in GitHub Desktop.
SQL statement to get a list of enabled products that are not in any categories
SELECT cpe.entity_id,
cpe.sku
FROM catalog_product_entity AS cpe
LEFT JOIN catalog_category_product AS ccp
ON cpe.entity_id = ccp.product_id
LEFT JOIN catalog_product_entity_int AS cpi
ON cpe.entity_id = cpi.entity_id
WHERE category_id IS NULL
AND attribute_id = (SELECT attribute_id
FROM `eav_attribute`
WHERE `attribute_id` LIKE '80')
AND cpi.value = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment