当我搜索'约塞米蒂公园'时,获取'优胜美地国家公园'的记录。
- SELECT * FROM table WHERE col LIKE '%yosemite%'; Works
- SELECT * FROM table WHERE col LIKE '%yosemite national%'; Works
- SELECT * FROM table WHERE col LIKE '%yosemite national park%'; Works
- SELECT * FROM table WHERE col LIKE '%yosemitenationalpark%'; Not Working
- SELECT * FROM table WHERE col LIKE '%yosemite park%'; Not Working
- SELECT * FROM table WHERE col LIKE '%park yosemite%'; Not Working
还有其他方法请建议吗?
答案 0 :(得分:1)
就像只是一个正则表达式 - 它不会以不同的顺序找到单词。
如果你想以任何顺序,你可以做这样的事情(如果你的桌子很大,效率不高):
SELECT * FROM table WHERE col LIKE '%park%' and col like '%yosemite%'
答案 1 :(得分:0)
尝试类似
的内容SELECT * FROM table WHERE col LIKE '%yosemitepark%' OR REPLACE(col," ","") LIKE '%yosemitepark%'