I'm using the following code to get the number of rows from a table that are in a specific category. For some reason it keeps saying there's one row when there's only two rows in the category. There's one a different category (not 6) and the menu status is set to 0, but it's still returning a result of 1. Can anybody find an error in my statement?
Code:
SELECT count(customer.category_id)
FROM customer
LEFT OUTER
JOIN menu
ON menu.customer_id = customer.id
AND menu.status = '1'
LEFT OUTER
JOIN category
ON category.id = customer.category_id
WHERE customer.category_id = '6'
Also, is there anyway to visualize what it's doing when running statements? Like seeing the tables how they look when they are joined?