I have the below query:
SELECT p.id as prod_id, * FROM products AS p
LEFT JOIN Product_UPC AS UPC ON UPC.ProductID = p.id
LEFT JOIN Brands AS b ON p.brand = b.id
LEFT JOIN productCategoryLink AS c ON c.ProductID = p.id
WHERE (p.id = '$this->prod_id')
A product can be assigned to multiple categories and therefore I have a composite table consisting of product and category IDs. I want to amend the above query so that it only brings out one row of data as at the moment it bring out multiple depending on how many categories there are in the composite table. I would like to somehow have the rows of category IDs brought out and added to the one row.
eg.
id | name | desc | category1| category2| category3 | price
Is this possible? If so how?