如何在MS Access中实现SQL INTERSECT和MINUS操作 [英] How can I implement SQL INTERSECT and MINUS operations in MS Access

查看:1357
本文介绍了如何在MS Access中实现SQL INTERSECT和MINUS操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究过,并没有找到一种方法在MS Access中运行INTERSECT和MINUS操作。无论如何都存在

I have researched and haven't found a way to run INTERSECT and MINUS operations in MS Access. Does any way exist

推荐答案

INTERSECT是一个内部联接。 MINUS是一个外部联接,您只能选择其他表中不存在的记录。



INTERSECT

INTERSECT is an inner join. MINUS is an outer join, where you choose only the records that don't exist in the other table.


INTERSECT

select distinct
  a.*
from
  a
  inner join b on a.id = b.id






MINUS

select distinct
  a.*
from
  a
  left outer join b on a.id = b.id
where
  b.id is null

如果您编辑原始问题并发布一些示例数据,则可以给出示例。

If you edit your original question and post some sample data then an example can be given.

编辑:忘记在查询中添加。

Forgot to add in the distinct to the queries.

这篇关于如何在MS Access中实现SQL INTERSECT和MINUS操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆