MySQL Forums
Forum List  »  MyISAM

exclusion query for the referenced table via JOIN
Posted by: Daniel
Date: March 23, 2005 03:18AM

Anyone knows who to make exclusion query when table is referenced via JOIN:

SELECT * FROM ae_articles AS art
LEFT JOIN ae_articlesections AS sec ON art.ID=sec.articleID
LEFT JOIN ae_articlesections AS sec2 ON art.ID=sec2.articleID
LEFT JOIN ae_articlesections AS sec3 ON art.ID=sec3.articleID
WHERE 1 AND (art.title LIKE '%bush%') AND sec.sectionID='1' AND sec2.sectionID='2' AND sec3.sectionID<>'3'
GROUP BY art.ID

This returns all articles, even those that are in section ID 3. I only want to retrieve those that are in section 1 AND 2, but NOT 3! How to do this?

Options: ReplyQuote


Subject
Views
Written By
Posted
exclusion query for the referenced table via JOIN
5087
March 23, 2005 03:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.