I have a table that uses the SET data type for one of the fields and to check if the field contains a specific item that I use
SELECT * FROM table WHERE myset LIKE %value%;
This works most of the time, but two of the potential meanings have the same word, i.e. one of the possible elements in the set is a poodle, and the other is a toy poodle. If i do
SELECT * FROM table WHERE myset LIKE %Poodle%;
It returns all rows containing a poodle or poodle. I want it to return only if the field contains a poodle. If I remove the wildcards, it will return lines that contain ONLY a poodle. So basically, if the table was:
id | myset ------------------------- 1 | "Poodle" 2 | "Toy Poodle" 3 | "Poodle","Toy Poodle" 4 | "Toy Poodle","Poodle"
I need a select statement that will return 1,3 and 4, but not 2. Is this possible?
mysql
awestover89
source share