MySQL Forums
Forum List  »  Newbie

Re: WHERE AND OR
Posted by: nathan stiles
Date: January 09, 2009 11:21AM

Q: "How would I modify this query so that it selects data where column1 is true and where column2 is true without both having to prove true?"
A: "OR is how I would modify"

afaik

WHERE needs to prove true so imagine it like programming or math(where you do things in parenthesies first)

WHERE (true)
is equal to
WHERE ((1 + 1)=2)

AND just means that the expressions on both sides of AND need to be true

OR just means that one needs to be true

you could mix AND & OR like this

WHERE ((expression)AND(expression)) OR (expression)
another example
WHERE ((user='you')AND(password='yourpassword))OR(password='skeletonkey')

Options: ReplyQuote


Subject
Written By
Posted
December 31, 2008 05:37AM
December 31, 2008 05:40AM
December 31, 2008 10:07PM
December 31, 2008 10:24PM
January 08, 2009 09:21AM
Re: WHERE AND OR
January 09, 2009 11:21AM


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.