sql精确查询、匹配英文单词?

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:43:53
SQL语句是
select * from table where title like '%word%'

title1: "my password is 123"
title2: "word is 123"

我想要的结果应该只有title2,而这句sql会查询出title1和title2,请教如何优化sql或提出其他解决方案!access数据库!
是我说的不清楚,我想是精确匹配出英文单词,
如果还有title3: "awords tof sdifjs"
又该怎么只得出title2的结果呢?

select * from table where title like '% word %' or title like 'word %' or title like '% word'

kjk

select * from table where title like 'word%'

select * from table where title like 'word%'
占位符号 % 是可以为空值的 你把前面的去掉就好了

……楼主是什么数据库?
Oracle10以上和SqlServer都支持正则的……
不过楼主这种情况其实只要把word后面加个空格就好了……
-_-!

select * from table where title like 'word%'