I need some help writing an sql query. The query below works but it's not returning the results I'm expecting.
Goal: I need the category_id and title of all categories with the parent_id of 92, and whose products have a quantity of more than 0.
I added exp_br_product.quantity to the query to see why it was returning results with products whose quantity was 0 and found that the results do not accurately reflect the quantity in the exp_br_product table. The other issue is that the results are repeating 4 times.
These are the results I'm expecting
96 DEPOSIT: Fill Your Freezer
97 DEPOSIT: Family Packs
98 DEPOSIT: Ground Beef
I've embedded images so you could see what I'm looking at.
SELECT DISTINCT exp_br_category.category_id, exp_br_category.title
FROM exp_br_product, exp_br_category, exp_br_product_category
WHERE exp_br_product.quantity > 0 AND exp_br_category.parent_id = 92