I'm having trouble with a SELECT query.
SELECT P.product_id
, ( SELECT Category_id
FROM Category C
WHERE C.product_id = P.product_id) AS cat
FROM Products P
This is supposed to pull the product_id from PRODUCTS and the category_id from CATEGORY. If the product is in multiple categories, I would like Categories field to return a list of those category_ids. The problem is a subquery will only return a single value. Does anyone know how to rewrite this?
Thanks!