求ASP中的绝对模糊搜索SQL语句

2025-12-15 00:45:20
推荐回答(5个)
回答1:

SQL= "select title from News where freetext(title,'中国北京')
或者一个比较难的搜索
rs.open "select*from news",conn,1,1
dim a,b,z,m,o
'a为数据库要找的字短内容,b为其它页面传过来要查找的内容
b=request.form("body")
b=replace(b," ","")
f=0
if len(b) > 2 then
f=1
if len(b) > 5 then
f=2
do while not rs.eof
m=0
a=rs("title")
for i=1 to len(b)-o '-1 for j=1 to i
z=mid(b,j,len(b)-i+1)
if instr(a,z) then
m=1
a=replace(a,z,"" & z & "")
response.write a
exit for
end if
next
if m=1 then
exit for
end if
next
rs.movenext
loop%>
这个是朋友给做的

回答2:

只能分开写吧. title like '%中国%' OR title like '%北京%'
这个好象牵扯到分词技术..

我也不大清楚..留个记号..等待高手

回答3:

做个全文检索吧,FREETEXT的效率也比较高。

回答4:

ql="select title from news where (title like'%中国%'or title like'%北京%')"

回答5:

看我的:
sql="select title from news where title like'%中国%'or title like'%北京%'"

这样就都来了.