Jump to content

Recommended Posts

why would you use BOTH "code IN ('A','B','C')" AND "code IN ('A','B')"

 

theres no point to that. If you want where the code is A or B, just use "code IN ('A','B')"

 

::) I knew someone would do this... please read again

 

I want it to only get ones where the code is A or B. I know this seems weird but I have to do it this way in order to accomplish what I want to.

 

Please just answer the question or move along. Don't need smart ass remarks.

Don't need smart ass remarks

 

Then provide some more information or an example of what you want to achieve because I agree with ohdang888 from what I read from you.

 

Edit: Removed last reply. Don't feel like getting into it. I have provided all the required information. Sometimes people should drop the ego and just help imo. If I had to ask the question in non-programmming terms I guess I could say if I have a bucket of apples and I am trying to grab green,red and yellow apples but I'm told I'm not allowed to have green apples then I would use that query. Thanks anyways for the help. 

I don't know why i'm even helping you after how much of an aggroant ass you apparently, but anyways: the IN statement does that for you, what you are trying to achieve. Your logic of trying to use "code IN ('A','B','C') AND code IN ('A','B')" does not make sense in the least.

I want it to only get ones where the code is A or B.

Then why are you trying to add "C" in there, if you ONLY want A or B?

 

are you exploding a array that has data you don't want in there? If not, i don't see what your issue is.

 

And, while i'm no expert, i've been using mysql for 3 years. So before you start complaining that i don't know my stuff, why don't you do a few of the following things:

1)realize this is FREE help

2)word your problem better, cause its not like you're getting an overwhelming response here

I don't know why i'm even helping you after how much of an aggroant ass you apparently, but anyways: the IN statement does that for you, what you are trying to achieve. Your logic of trying to use "code IN ('A','B','C') AND code IN ('A','B')" does not make sense in the least.

I want it to only get ones where the code is A or B.

Then why are you trying to add "C" in there, if you ONLY want A or B?

 

are you exploding a array that has data you don't want in there? If not, i don't see what your issue is.

 

And, while i'm no expert, i've been using mysql for 3 years. So before you start complaining that i don't know my stuff, why don't you do a few of the following things:

1)realize this is FREE help

2)word your problem better, cause its not like you're getting an overwhelming response here

 

I never said that you didn't know your stuff. All I said was that you told me basically that it was pointless for me to do what I was doing. I realize that what I am doing seems stupid to most but the only thing I wanted to know is if it would give the result I expected it to or if, due to the way php works, it would go bonkers because I tried to do something that doesn't logically make sense to do. Instead you guys wanna sit on the fact that I am doing something that seems stupid to you. All I am doing is trying to solve a problem that I have and this is the easiest way I know to do it.

 

Let me give you the following example:

 

Suppose I am a normal guy who asks "If I walk backwards starting at point A is it possible to reach point B? I know it doesn't make sense to walk backwards but that's what I want to do."

 

Then you say "Why the hell would you want to walk backwards when you can walk forwards?"

 

All I wanted to know is if I could make it to point B walking backwards.

 

and if you have to know about the reason why I am doing it it's because someone can search a database by anything in my system. However certain people don't have access to records in the database and therefore even if they want to search for A, B, and C I need to limit it to their privileges which are only A and B

and if you have to know about the reason why I am doing it it's because someone can search a database by anything in my system. However certain people don't have access to records in the database and therefore even if they want to search for A, B, and C I need to limit it to their privileges which are only A and B

 

Ah! Now we're getting somewhere!

 

This isn't tested, but you should be able to do this with a NOT statement....

SELECT * FROM table WHERE code IN('A', 'B', 'C') AND code != 'C'

 

and if you have to know about the reason why I am doing it it's because someone can search a database by anything in my system. However certain people don't have access to records in the database and therefore even if they want to search for A, B, and C I need to limit it to their privileges which are only A and B

 

Ah! Now we're getting somewhere!

 

This isn't tested, but you should be able to do this with a NOT statement....

SELECT * FROM table WHERE code IN('A', 'B', 'C') AND code != 'C'

 

I would do that but my permissions are set up to only have things that they can access. Not a list of things they can't ;)

I apologize for any rude statements on my part. Anywho I've tested the other way that I mentioned and it works well :) Thank you for the help.

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.