select * from data WHERE name LIKE '%Hi There%';
返回:
Hi There John
Hi There
Man Hi There
Hi There Mate
Hi Theres Alice
Hi Theree Man
我只希望 Hi There John
、Hi There Mate
、Hi There
和 Man Hi There
成为返回是因为它们专门包含 Hi There
。 Hi Theres Alice
和 Hi Theree Man
不应出现。
这如何简单地完成?
最佳答案
如果我理解正确,这应该有效:
SELECT * FROM data WHERE
name LIKE 'Hi There %' OR
name LIKE '% Hi There %' OR
name LIKE '%Hi There';
关于mysql - 在mysql中搜索特定的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53678100/