Extract categories for products

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Tea-Dev
Lieutenant (LT)
Lieutenant (LT)
Posts: 55
Joined: Wed Oct 12, 2011 11:15 am

Extract categories for products

Post by Tea-Dev » Fri Apr 04, 2014 7:49 am

Hi.
I am trying to extract the categories for all the products identified in ac_Products. I can see the ac_Categories, but unable to join these 2 tables together.
Would anyone be able to provide a select statement where we can get the products and the categories they belong to (ac_products.productId, ac_Categories.Name, ....).

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Extract categories for products

Post by mazhar » Fri Apr 04, 2014 11:32 am

you need to look into ac_CatalogNode table. The SQL could be something like

Code: Select all

SELECT CN.CategoryId, P.Name
JOIN ac_CatalogNodes AS CN
JOIN ac_Products AS WP ON CN.CatalogNodeId = P.ProductId
WHERE CN.CatalogNodeTypeId = 1

User avatar
tripleW
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 46
Joined: Wed Oct 30, 2013 5:38 am

Re: Extract categories for products

Post by tripleW » Thu May 15, 2014 7:54 am

This worked for me with a couple adjustments.

SELECT CN.CategoryId, P.Name
FROM ac_CatalogNodes AS CN
JOIN ac_Products AS P ON CN.CatalogNodeId = P.ProductId
WHERE CN.CatalogNodeTypeId = 1

Post Reply