having a bit of a prob with this, though I’m sure it’s simple!
I have a table where product IDs are matched to category ID, these are the only 2 fields in the table.
I want to see whether all the products in the cards category (ID=100) are in any other categories, or just that one. I tried a few things but can’t figure the query out.
SELECT products_id, count(categories_id) as cats_in FROM `products_to_categories` WHERE categories_id = 100 group by products_id
This always shows 1 for the cats_in column, even though I know some of them are in more than one category as I have checked. I know I’m useless with grouping and counting, so help to understand this would be great!
try this: