sql 问题

Zoogreen 2003-05-08 08:44:24
假设有两个表table1,table2两个表中都有goodsname字段 ,table2中有 checkman 字段
要求找table1的所有数据 , table1中的 goodsname 要等于 从table2中取得的 goodsname , 先从 table2中取得数据 select goodsname from table2 where checkman='a', 只 这个数据集中有的goodsname ,在table中都要找到 说了半天就是连表查询啦 ,我写了:
select * from table1 where goodsname in select goodsname from table2 and checkman='a' 这样出错???
...全文
43 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Olamny 2003-05-09
  • 打赏
  • 举报
回复
select * from table1 where goodsname in (select goodsname from table2 where checkman='a')
foilsman 2003-05-08
  • 打赏
  • 举报
回复
select * from table1 where table1.goodsname in (select table2.goodsname from table2) and table1.checkman='a'

828

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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