Jump to content

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/8496-select-this-or-that/
Share on other sites

[!--quoteo(post=368987:date=Apr 26 2006, 01:40 PM:name=onepixel)--][div class=\'quotetop\']QUOTE(onepixel @ Apr 26 2006, 01:40 PM) [snapback]368987[/snapback][/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
Link to comment
https://forums.phpfreaks.com/topic/8496-select-this-or-that/#findComment-31089
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.