Forum Moderators: coopster
SELECT *
FROM products LEFT JOIN shop_items ON products.code=shop_items.parentID
WHERE shop_items.basketID='4'
GROUP BY category
2 tables - one lists all the products the other is the shopping basket which will hold the productID(parentID) and QTY etc. basketID is the unique customer identifier
All i want to do is list all the product categories and then in each category display the relevant basket item
Example -
FRUIT
- apple
- orange
VEG
- NULL
DAIRY
- milk
The WHERE statement is obviously limiting the results returned but how else can I do it? The only other way is to filter out the basketID in the PHP code i.e if($basketID=="4"){Show results}
Is there something I'm missing?