Using the IN or BETWEEN operator and index 
values on an ENUM column fails:

CREATE TABLE test (c enum ('one', 'two'));
INSERT INTO test VALUES (1), (2);

SELECT * FROM test WHERE c='one' OR c='two';
  -- works, returns both rows
SELECT * FROM test WHERE c=1 OR c=2;
  -- works, returns both rows

SELECT * FROM test WHERE c IN ('one', 'two');
  -- works, returns the two rows
SELECT * FROM test WHERE c IN (1, 2);
  -- fails, 0 rows returned

SELECT * from test WHERE c BETWEEN 'one' AND 'two';
  -- works, returns the two rows  
SELECT * from test WHERE c BETWEEN 1 AND 2;
  -- fails, 0 rows returned

MyISAM tables on v. 3.23.45.

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to