Let’s say I have a table with the following contents: (just some random values)
year
2005
2009
2010
2912
2982
2947
When I query:
SELECT userid FROM tbluser WHERE year!=2005 or year!=2010
It will output all the years. Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The other answers suggest what to do already, but I’d like you to make the test yourself (funnily, I am doing it now…):
You have
Now, check some number for list against that condition. E.g., use 2011:
insert the preliminary results into your condition:
If you think this further, then the condition is true for every value on the world, because a single value can’t be equal to multiple, different values.
E.g., use 2005:
then