Created
December 7, 2015 20:07
-
-
Save mpchadwick/37bf41dfc363a052cbba to your computer and use it in GitHub Desktop.
Magento Enabled Categories with No Products
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace the attribute IDs as needed | |
SELECT | |
cce.entity_id AS "Category ID", | |
cce.path as "Category Path", | |
ccev.value as "Category Name", | |
COUNT(ccp.product_id) as "Number of Products" | |
FROM catalog_category_entity cce | |
INNER JOIN catalog_category_entity_varchar ccev | |
ON cce.entity_id = ccev.entity_id | |
INNER JOIN catalog_category_entity_int ccei | |
ON cce.entity_id = ccei.entity_id | |
LEFT OUTER JOIN catalog_category_product ccp | |
ON cce.entity_id = ccp.category_id | |
WHERE ccev.attribute_id = 41 | |
AND ccei.attribute_id = 42 | |
AND ccei.value = 1 | |
GROUP BY cce.entity_id | |
HAVING COUNT(ccp.product_id) < 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment