1

I need a sql query to get the all sku based on the category id

Following are the tables which stores category and product data:

catalog_product_entity

catalog_category_product

Thanks

2 Answers 2

5

Your Sql query will be like this:

`SELECT * FROM catalog_product_entity where entity_id in (SELECT product_id FROM catalog_category_product where category_id = {YourCategoryId})`.
0
1
SELECT product.entity_id as product_id, product.sku FROM catalog_product_entity as product
    INNER JOIN catalog_category_product as cat_prod on product.entity_id = cat_prod.product_id
    WHERE cat_prod.category_id=YOUR Category ID;

Tried using inner join,this one also worked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.