From: MN on 13 Apr 2010 12:02 Hi - I need to run a query to find out in a tableA field gender has some other value than 1,2,3. But this will product all records ! It was included 1,2,3,4,5...8,9. If I using "AND" then it come out just records 4,5,6,7,8,9 Is it weird ? Thank you for any reply . SELECT * FROM TableA WHERE gender<>1 OR gender <> 2 or gender<>3;
From: KARL DEWEY on 13 Apr 2010 12:49 SELECT * FROM TableA WHERE [Gender] Not Between 1 AND 3; -- Build a little, test a little. "MN" wrote: > Hi - I need to run a query to find out in a tableA field gender has some > other value than 1,2,3. > But this will product all records ! It was included 1,2,3,4,5...8,9. > If I using "AND" then it come out just records 4,5,6,7,8,9 > Is it weird ? Thank you for any reply . > > SELECT * > FROM TableA > WHERE gender<>1 OR gender <> 2 or gender<>3;
From: Marshall Barton on 13 Apr 2010 13:29 MN wrote: >Hi - I need to run a query to find out in a tableA field gender has some >other value than 1,2,3. >But this will product all records ! It was included 1,2,3,4,5...8,9. >If I using "AND" then it come out just records 4,5,6,7,8,9 >Is it weird ? Thank you for any reply . > >SELECT * >FROM TableA >WHERE gender<>1 OR gender <> 2 or gender<>3; And what about the AND didn't you like? Seems like the 4,5 .... are the ones you want to see?? If the problem is that you also have some records where the gender field is Null, then: WHERE (gender<>1 AND gender <> 2 AND gender<>3) OR gender Is Null -- Marsh MVP [MS Access]
From: MN on 13 Apr 2010 14:14 Thank for reply, actual value are: 1,2,3,4,88,99 And I want to see in this field do they have a different value other than those number? Regards, "KARL DEWEY" wrote: > SELECT * > FROM TableA > WHERE [Gender] Not Between 1 AND 3; > > -- > Build a little, test a little. > > > "MN" wrote: > > > Hi - I need to run a query to find out in a tableA field gender has some > > other value than 1,2,3. > > But this will product all records ! It was included 1,2,3,4,5...8,9. > > If I using "AND" then it come out just records 4,5,6,7,8,9 > > Is it weird ? Thank you for any reply . > > > > SELECT * > > FROM TableA > > WHERE gender<>1 OR gender <> 2 or gender<>3;
From: MN on 13 Apr 2010 14:17
I mean I like the AND than but the logical here somthing make me confused? OK-The user want to print out all of record if the field gender have diferent value other than 1,2,3,4,77,99 and you was right null is count too. Thank you. "Marshall Barton" wrote: > MN wrote: > > >Hi - I need to run a query to find out in a tableA field gender has some > >other value than 1,2,3. > >But this will product all records ! It was included 1,2,3,4,5...8,9. > >If I using "AND" then it come out just records 4,5,6,7,8,9 > >Is it weird ? Thank you for any reply . > > > >SELECT * > >FROM TableA > >WHERE gender<>1 OR gender <> 2 or gender<>3; > > > And what about the AND didn't you like? Seems like the 4,5 > .... are the ones you want to see?? > > If the problem is that you also have some records where the > gender field is Null, then: > > WHERE (gender<>1 AND gender <> 2 AND gender<>3) > OR gender Is Null > > -- > Marsh > MVP [MS Access] > . > |