Solved

Eliminating records from filea that match fileb - Access 2007

Posted on 2011-02-18
4
246 Views
Last Modified: 2012-08-13
I have two tables that I can match by ID.  If the ID on table A is found on Table B, I do not want to include the record on Table C.  If there is no match that I would like to include the record on Table C.
How can I do this is Access?  
0
Comment
Question by:morinia
  • 2
4 Comments
 
LVL 12

Expert Comment

by:geowrian
ID: 34931425
Did you try this?

INSERT INTO TableC(field1, field2, etc)
SELECT field1, field2, etc FROM Table1
LEFT OUTER JOIN Table2
ON Table1.ID=Table2.ID
WHERE Table2.ID IS NULL

Open in new window

0
 
LVL 10

Accepted Solution

by:
Michael Vasilevsky earned 500 total points
ID: 34931426
SELECT * FROM TableA WHERE TableA.ID NOT IN (SELECT ID FROM TableB)
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34931429
does tablec already exists?

if it is, using an append query

insert into tablec
select tablea.* from tableA  as A
left join tableB as B On A.ID=B.ID
where B.ID is null
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34931436
if tableC does not exists, use a make table query

select A.* into tableC
from tableA as A
left join tableB as B On A.ID=B.ID
where B.ID is null
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now