mysql in list only validates first id in list. maybe a blob issue -


I work with a system that uses values ​​separated by commas as one-two-multiple links Does. It is stored as a blob.

I try to use MySQL IN (LIST), but only ends with the rows where the UID is the first in the list or only one in the list.

  mytable uid categories 1 24,25,26 2 25 3 22,23,25 4 25,27 runs SQL: SELECT * from mytable Where 25 categories (categories) results: uid categories 2 25 4 25, 27 missing (should be selected, but not) UID categories 1 24, 25, 26 3 22, 23, 25 Any idea why to start with string 25 and  Not only are 25? I think this is a string problem instead of INSTALL  

UPDATE - based on the answer given below:

When IN ( LIST) On a blob, blob turns into an int and comma and "points" are lost.

In use FIND_IN_SET (needle, hexstack) which will also work on a blab with a comma-separated value.

I think you should

  SELECT * mytable WHERE FIND_IN_SET Searching (25, category)    

Comments