Don't Join on a not equal to unless you are absolutly sure of what you are doing.
Instead I think the following:
SELECT category, category_ID FROM categories WHERE category_ID NOT IN (SELECT category_ID FROM stories_category WHERE story_ID = '1')
Translates to:
SELECT categories.category, categories.category_ID FROM categories LEFT JOIN stories_category ON categories.category_ID = stories_category.category_ID WHERE (story_ID != '1');
Comments 1
Instead I think the following:
SELECT category, category_ID FROM categories WHERE category_ID NOT IN (SELECT category_ID FROM stories_category WHERE story_ID = '1')
Translates to:
SELECT categories.category, categories.category_ID FROM
categories LEFT JOIN stories_category ON categories.category_ID = stories_category.category_ID
WHERE (story_ID != '1');
Reply
Leave a comment