I am trying to retrieve a list of comma separated product categories for a product.
Here is an idea of what I am trying to do:
SELECT *, (
SELECT CategoryName
FROM ProductCategories pc
WHERE p.ProductId=pc.ProductId) as ProductCategories
FROM Products p
I need the product categories to be in a comma separated list. Is there a way to do it using COALESCE?