高分求助,如果正确,立即给分!关于查询问题!!100分!!!!

ziqing 2003-04-08 10:11:26
在两个表中,各有许多仓库,在每个仓库中有许多商品
我想查出两个表中在仓库 相同的情况下,而商品 不同的记录!!
...全文
21 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ziqing 2003-04-08
  • 打赏
  • 举报
回复
不好意思!!to weitao999,我急于结贴,没看清楚!!请原谅!!
weitao999 2003-04-08
  • 打赏
  • 举报
回复
两位?
:(
ziqing 2003-04-08
  • 打赏
  • 举报
回复
谢谢两位!!!
weitao999 2003-04-08
  • 打赏
  • 举报
回复
如果两表结构不同的话可以select具体的字段:
倒是可以优化一下的:
with temp as (select a.sp from a, b where a.ck=b.ck and a.sp=b.sp)
select * from a where sp not in (select sp from temp) union select * from b where sp not in (select sp from temp)
weitao999 2003-04-08
  • 打赏
  • 举报
回复
select * from a where sp not in (select a.sp from a, b where a.ck=b.ck and a.sp=b.sp)) union select * from b where sp not in (select a.sp from a, b where a.ck=b.ck and a.sp=b.sp))

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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