多表查询问题,请各位帮忙。谢谢了

liuvb 2003-08-24 10:47:09
数据库(access)中有两个表saledate,saleproduct

saledat表格式如下:

number shopname start end
20030810 11 2003-8-1 2003-8-10
20030820 22 2003-8-10 2003-8-20


saleproduct表格式如下:
salenumber productname price
20030810 话梅 11
20030810 梅肉 22
20030810 陈皮 222
20030820 杨梅 2121
20030820 芒果 5454

要查询saleproduct中含有“话梅”的项,显示在浏览器格式如下:

number shopname start end
20030810 11 2003-8-1 2003-8-10









...全文
40 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuvb 2003-08-24
  • 打赏
  • 举报
回复
saledate中有很多条符合条件的记录,如果按以上方法,只能返回一条记录。
chen6073 2003-08-24
  • 打赏
  • 举报
回复
对的!
zhuyangfeng 2003-08-24
  • 打赏
  • 举报
回复
SQL="SELECT number,shopname,start,end FROM saledate,saleproduct WHERE saleproduct.productname='话梅' AND saleproduct.price=saledate.shopname"
xuya 2003-08-24
  • 打赏
  • 举报
回复
sql="select * from saledate where number=(select salenumber from saleproduct
where productname='话梅')"
wolf004 2003-08-24
  • 打赏
  • 举报
回复
sql="select * from saledate where number=(select salenumber from saleproduct
where productname="话梅")"
bluefox168 2003-08-24
  • 打赏
  • 举报
回复
应该是这样:
select a.number,a.shop,a.start,a.end from saledat a,saleproduct b where b.productname="话梅" and a.number=b.salenumber
bluefox168 2003-08-24
  • 打赏
  • 举报
回复
select a.number,a.shop,a.start,a.end from saledat a,saleproduct b where b.productname="话梅"
liuvb 2003-08-24
  • 打赏
  • 举报
回复
这些字段是saledate表里面的
wjh6of6agriculture 2003-08-24
  • 打赏
  • 举报
回复
marktename,startdate,enddate,mode,remark 这些字段哪来的?
liuvb 2003-08-24
  • 打赏
  • 举报
回复
我是用下面这种方法写的,怎么不行?

sql="select number,writedate,marktename,startdate,enddate,mode,remark from saledate ,saleproduct where saleproduct.saleproduct like '%"&find_name&"%'"

28,390

社区成员

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

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