MySQL, SQL Select Statement, Where with OR... What's wrong with this?

Posted by nobosh on Stack Overflow See other posts from Stack Overflow or by nobosh
Published on 2010-03-09T05:09:26Z Indexed on 2010/03/09 5:21 UTC
Read the original article Hit count: 297

Filed under:
|

I'm looking for help with my query below. which is never returning anything for veggie... Is the way I have my WHERE statement written valid?

SELECT *
FROM newsfeed INNER JOIN newsfeedaction ON newsfeed.newsfeedactionid = newsfeedaction.newsFeedActionID
  INNER JOIN person ON newsfeed.personID = person.personID
  LEFT OUTER JOIN food ON newsfeed.foodID = food.foodID
  LEFT OUTER JOIN veggie ON newsfeed.veggieID = veggie.veggieID
WHERE  
  (
  newsfeed.veggieID IS NOT NULL
  AND veggie.deleted = 'N'
  )
 OR
  (
  newsfeed.foodID IS NOT NULL
  AND food.deleted = 'N')

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql