Created
December 14, 2012 19:49
-
-
Save heathdutton/4288090 to your computer and use it in GitHub Desktop.
Find all instances of registry/holiday products that are missing from the website that they exist in.
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
/* Find all instances of registry/holiday products that are missing from the website that they exist in */ | |
SELECT * FROM | |
enterprise_giftregistry_item, | |
enterprise_giftregistry_entity, | |
catalog_product_website | |
WHERE | |
enterprise_giftregistry_entity.entity_id = enterprise_giftregistry_item.entity_id AND /* get the registry entity */ | |
enterprise_giftregistry_item.product_id = catalog_product_website.product_id AND /* get the product entity */ | |
enterprise_giftregistry_entity.website_id NOT IN ( | |
SELECT | |
catalog_product_website.website_id | |
FROM | |
catalog_product_website | |
WHERE | |
catalog_product_website.product_id = enterprise_giftregistry_item.product_id | |
); /* check if the product is in the website tied to the registry */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment