Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The IN comparison operator seems to

Status
Not open for further replies.

xencatx

IS-IT--Management
Aug 22, 2002
7
GB
The IN comparison operator seems to completely disregard case-sensitivity enforced by BINARY at table creation.
Example, the queries:
(i) SELECT * FROM mytable WHERE myfield NOT IN ('F', 'd');
(ii) SELECT * FROM mytable WHERE (myfield != 'F') OR (myfield != 'd');
return completely different sets even though 'myfield' has been declared a BINARY field.
Hmmm! Is this a bug or am I doing something wrong here?
Any thoughts?

xencatx

 
Code:
SELECT * FROM mytable WHERE (myfield != 'F') and (myfield != 'd');

is the same as (i)
 
Sorry to disagree with you swampBoogie but the figures speak otherwise:

SELECT * FROM mytable WHERE myfield NOT IN ('F', 'd')
RETURNS 219 rows

SELECT * FROM mytable WHERE (myfield != 'F') AND (myfield != 'd')
RETURNS 260

SELECT * FROM mytable WHERE (myfield != 'F') OR (myfield != 'd')
RETURNS 260 rows

Cheers

xencatx
 
The first two queries in your example should return the same result. So, this indicates an erroneous behaviour in Mysql.

 
Aha! My point exactly - mySQL *is* behaving rather erroneously! Do you think I should report this to the DataKonsult guys?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top