繁体   English   中英

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

[英]how to check that a field in mysql contains a specific word

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

示例:字段“名称” = 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%

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM