gpt4 book ai didi

php - MySQL查询以搜索匹配单个单词

转载 作者:太空宇宙 更新时间:2023-11-03 12:21:38 25 4
gpt4 key购买 nike

在这里,我尝试使用 MySQL 查询来搜索以匹配精确的单个单词。

SELECT `text` FROM `tbl_strings` WHERE `text` LIKE "%pencil%"

我想得到一个包含单词“pencil”而不是“pencils”的结果。感谢所有的灵感。

最佳答案

SELECT `text` FROM `tbl_strings` WHERE `text` REGEXP '[[:<:]]pencil[[:>:]]'

查看 SQL fiddle 链接:http://sqlfiddle.com/#!2/48924/1

关于php - MySQL查询以搜索匹配单个单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19632862/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com