Hi everyone, I'm a PHP newbie, and am having trouble. If anyone can help, I would greatly appreciate it.
I have a query of products and categories. What I would like to do is display the list of all the products by category, with the category displaying only once with all of the corresponding products below it.
Example:
Category A
Product 1
Product 2
.
.
.
Category B
Product 3
Product 4
Product 5
Here is my query:
SELECT p.ProductID, p.ProductCode, p.ProductDescription, c.categoryName
FROM Product p
INNER JOIN productCategory c ON p.productCategoryID = c.productCategoryID
The problem is that the category name displays every time for every product.
I only want it to appear once, above the products associated with it.
Hope this makes sense.
Happy new year to all.
cheers,
aa