SQL help...

Jun 30, 2007 23:13

Question ( Read more... )

Leave a comment

Comments 1

necessitysslave July 1 2007, 08:59:00 UTC
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');

Reply


Leave a comment

Up