0

再会。

代码:

column name have rows:

about word test plus
about word tests plus
about word test plus
about word tests plus
about wordtest plus
about wordtests plus
about word testplus
about word testsplus
about wordtestplus
about wordtestsplus

我有 sql 查询:

SELECT * FROM TABLE WHERE text LIKE 'test' OR text LIKE 'tests'

请告诉我,当仅存在完整的单词测试或测试时如何仅选择行?

PS 在我的示例中,我需要获取行:

about word test plus
about word tests plus
about word test plus
about word tests plus
4

2 回答 2

3
SELECT * FROM TABLE WHERE ' '+text+' ' LIKE '% test %' OR ' '+text+' ' LIKE '% tests %'
于 2013-11-06T10:35:39.637 回答
3

您需要此查询来接收所需的结果:

SELECT * FROM TABLE WHERE name LIKE '% test %' OR name LIKE '% tests %';
于 2013-11-06T10:38:28.957 回答