关于模糊查询语句

IT_Fish 2005-07-05 12:21:45
因为我需要实现模糊查询
sql = "select * from product where lb like '%" & key & "'%"
因为lb列有重复,我要的结果不需要重复的纪录
所以我想问下
sql = "select * from product where lb like '%" & key & "'% group by lb"
可以用这语句来打开数据库实现搜索么?
...全文
152 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
IT_Fish 2005-07-06
  • 打赏
  • 举报
回复
试了好个SQL语句,可是好像没有可以达到效果的…… 郁闷……
IT_Fish 2005-07-05
  • 打赏
  • 举报
回复
好像都不行,谁帮我看看写个搜索语句啊
wooernet 2005-07-05
  • 打赏
  • 举报
回复
不行,
用DISTINCT
具体看SQL 联机帮助的select,你会学到更多
beiouwolf 2005-07-05
  • 打赏
  • 举报
回复
sql = "select * from product DISTINCT where lb like '%" & key & "'%"
加DISTINCT就行了
JasonJHu 2005-07-05
  • 打赏
  • 举报
回复
好像可以用UNION吧
JasonJHu 2005-07-05
  • 打赏
  • 举报
回复
应该可以的
devilzone 2005-07-05
  • 打赏
  • 举报
回复
不行
IT_Fish 2005-07-05
  • 打赏
  • 举报
回复
楼上的兄弟,你的办法好像还是不行,会出现下面的提示信息:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC driver does not support the requested properties.
/dwt/search.asp, line 20
xutao888 2005-07-05
  • 打赏
  • 举报
回复
sql = "select * from product where ID in(Select Max(ID) From product Group By 不重复的字段) lb like '%" & key & "%'"
游陆 2005-07-05
  • 打赏
  • 举报
回复
sql = "select distinct * from product where lb like '%" & key & "%'"

28,391

社区成员

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

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