在访问中进行查询 [英] make query in access
本文介绍了在访问中进行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以ms访问进行查询
我想做的是
2桌
1桌确保359 rec
2桌确保322 rec $ / $
我想查询只获取表2中不存在的记录(359)
并且确实存在于表1(322)中
结果应为37,因为322记录是两个表中存在的相同记录
I want to make query in ms access
what I want to do is
2 tables
1 tables secures 359 rec
2 tables secures 322 rec
I want to make query to get only those records which is not exist in table 2 ( 359 )
and do exist in table 1 ( 322 )
result should be 37 because 322 records are same records which exist in both tables
推荐答案
尝试INNER JOIN:当BOTH表中至少有一个匹配时返回所有行:
Try an INNER JOIN: It returns all rows when there is at least one match in BOTH tables:
SELECT a.* FROM Table1 a
INNER JOIN Table2 b
ON a.ID = b.ID
https://support.office.com/client/INNER-JOIN-Operation-b9e73ab6-884a-403e-9f22-cb502feae36a [ ^ ]
因为你需要不在表格中的记录a使用下面的查询
as you need the record not in table a use the below query
SELECT a.* FROM Table1 a
left JOIN Table2 b
ON a.ID = b.ID where b.id is null
这篇关于在访问中进行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文