[讨论]如何实现象google百度那样的模糊查询?
如题,想要实现输入“关键字+空格+关键字”的查询方式,该如何实现呢?是不是先判断有无空白字,然后再用Replace()实现呢?
以下是引用islet在2006-6-12 10:27:04的发言:
key=replace(replace(replace(replace(replace(replace(replace(request(keywords)," ","")," ","")," ","")," ","")," ","")," ","")," ","")
words=split(key," ")
sql="select * from table where 字段 like '%"&key&"%'"
for i= 0 to ubound(words)-1
sql=sql&" or 字段 like '%"&words(i)&"%'"
next
rs.open sql,conn,1,1
key=replace(replace(replace(replace(replace(replace(replace(request(keywords)," ","")," ","")," ","")," ","")," ","")," ","")," ","")
words=split(key," ")
sql="select * from table where 字段 like '%"&key&"%'"
for i= 0 to ubound(words)-1
sql=sql&" or 字段 like '%"&words(i)&"%'"
next
rs.open sql,conn,1,1
麻烦解释一下吧,谢谢了!有点看晕了