> > mysql> CREATE TABLE settest( chain SET( "A", "B", "C" ) NOT NULL, > UNIQUE INDEX ichain( chain ) ); > > mysql> INSERT INTO settest SET chain="A,C"; > > mysql> SELECT * from settest; > +-------+ > | chain | > +-------+ > | A,C | > +-------+ > > mysql> SELECT * FROM settest WHERE chain="A,C"; > +-------+ > | chain | > +-------+ > | A,C | > +-------+ > > mysql> SELECT * FROM settest WHERE chain="C,A"; > Empty set (0.00 sec)
++From Manual: http://www.mysql.com/doc/en/SET.html ++SET values are sorted numerically. NULL values sort before non-NULL SET values. That means when you create SET("A","B","C") they are assigned the decimal values of 1,2,4 ++mysql> SELECT * FROM tbl_name WHERE set_col = 'val1,val2'; ++mysql> SELECT * FROM tbl_name WHERE set_col & 1; ++The first of these statements looks for an exact match. The second looks for values +containing the first set member. Since they are sorted numerically, and WHERE chain="C,A" is looking for an exact match, it will not find it. > mysql> SELECT * FROM settest WHERE FIND_IN_SET("C,A", chain); > Empty set (0.01 sec) ++Normally, you perform a SELECT on a SET column using the LIKE operator or the +FIND_IN_SET() function: ++mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%'; ++mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0; Looks to me these are expecting "value" (singular) not "values" And regardless all of them are looking for exact matches against how the data is stored If you were to create with SET("C","A","B") looking for FIND_IN_SET("C,A",chain) would probably work Anyways, not considering myself a Guru, but that's how I am seeing it Luc --------------------------------------------------------------------- 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