Jump to content


Photo

Select This or That


  • Please log in to reply
2 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 26 April 2006 - 08:32 PM

Hi,

I have a MySQL query that looks like this:

SELECT * FROM test where test1 = 'Y' OR test 2 = 'N' AND testname = 'MINE'

Now I understand that is wrong, but I am not sure how to make the query do what I want.

I want to make the query true if test1 = Y OR test2 = N or even both.

How can do this properly?

#2 onepixel

onepixel
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 26 April 2006 - 08:40 PM

How about
SELECT * FROM test where (test1 = 'Y' OR test 2 = 'N') AND testname = 'MINE'

<a href="http://www.saheltech.com">PHP Programming - WordPress Blog Customization</a>

#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 26 April 2006 - 08:45 PM

[!--quoteo(post=368987:date=Apr 26 2006, 01:40 PM:name=onepixel)--][div class=\'quotetop\']QUOTE(onepixel @ Apr 26 2006, 01:40 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
How about
SELECT * FROM test where (test1 = 'Y' OR test 2 = 'N') AND testname = 'MINE'
[/quote]

Thats what I thought. Hehe silly me.

Thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users