Created
January 8, 2014 03:18
-
-
Save tegansnyder/8311225 to your computer and use it in GitHub Desktop.
Get list of skus and their corresponding category_ids with direct SQL Magento.
This file contains hidden or 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
| SELECT sku, GROUP_CONCAT(entity_id) as category_ids FROM ( | |
| SELECT c3.sku, c2.entity_id | |
| FROM catalog_category_product c1 | |
| INNER JOIN catalog_category_entity_varchar c2 ON (c1.category_id = c2.entity_id) | |
| INNER JOIN catalog_product_entity c3 ON (c1.product_id = c3.entity_id) | |
| WHERE c2.attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = 3) | |
| ) main | |
| GROUP BY sku |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment