如何检查mysql中的字段是否包含特定的单词


how to check that a field in mysql contains a specific word

我需要使用选择查询检查mysql中的字段是否包含特定的单词

exmaple:field'name'=test1,test2,test3

Select * from table where name Like '%test3%

它返回空,任何帮助

使用find_in_set():

SELECT * from `table` where FIND_IN_SET(name, 'test1,test2,test3 ');

使用它来查找单词,如test1、test2等

Select * from table where name Like '%test%'

试试这个:-

SELECT * FROM table WHERE name IN ( 'test1',' test2', 'test3');

'%test3%:后添加单引号

SELECT * FROM table WHERE name LIKE '%test3%