怎样同时搜索多个字段的关键字?

zc88888 2014-05-21 05:25:48
dim title
title=CSQL(request.form("search1"))
set rs=server.createobject("adodb.recordset")
exec="select * from shop where title like '%"&title&"%'"
rs.open exec,conn,1,1
if title="" then
response.write ("<script language=""javascript"">alert(""请输入搜索关键字!"");history.go(-1);</script>")
end if

这里只列出搜索title字段关键词的内容,怎样同时搜索出字段keywords,item的内容?
...全文
578 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
楔子 2014-05-22
  • 打赏
  • 举报
回复
select * from table where concat(name,title) like %keyword%;
zc88888 2014-05-22
  • 打赏
  • 举报
回复
有可以解决问题的方法吗?
楔子 2014-05-22
  • 打赏
  • 举报
回复
select * from table where concat(name,keyword,item) like %$keyword%;
zc88888 2014-05-21
  • 打赏
  • 举报
回复
试了下、连title都搜不到了
微wx笑 2014-05-21
  • 打赏
  • 举报
回复
哦,不好意思,后面的变量没改,不知你要的是这个么。
Thomas.Sir 2014-05-21
  • 打赏
  • 举报
回复
加个or 关键字试试: "select * from shop where title like '%"&title&"%'" or keywords like '%"&keywords&"%'" or item like '%"&item&"%'" 。这样会关键字会根据title 、keywords、item、先后顺序查找。
微wx笑 2014-05-21
  • 打赏
  • 举报
回复
exec="select * from shop where title like '%"&title&"%'" and keyword like '%"&title&"%'" and item like '%"&title&"%'"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧