Hi,
I was wondering if this is possible in MySQL 4.1.
I have 2 tables: Category, Products.
Each product links to a category using a foreign key.
I want to produce a query that will return the Catagory name in one column and all the product names under that category seperated by commas in the second column.
So, if Category1 has 4 products and Category2 has 2 products the output would be:
Code:
Category | Products
CategoryName1 | ProductName1, ProductName2, ProductName3, ProductName4
CategoryName2 | ProductName5, ProductName6
I tried playing around with CONCAT_WS and a GROUP BY on CategoryID but I think I have to have a subquery to pull out the product records for each category because the inner join method doesn't give me the right result.
Thanks