A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need a query to get rid of duplicates using two tables



 
 
Thread Tools Display Modes
  #1  
Old December 11th, 2009, 02:25 AM posted to microsoft.public.access.queries
Susan
external usenet poster
 
Posts: 651
Default Need a query to get rid of duplicates using two tables

I have 2 tables - one -A - has 100 records - the other - B - has 150
records - they have a common field NAME - table B has the same 100 records as
table A, plus 50 more - I want to create a table with only the 50 records
that are not unique to both tables. The tables I'm dealing with have much
more than 100 records so I need a query to take out the common records and
leave only the unique 50 records from table B. This is not the typical
"duplicate records" query as it relates to two tables. Help!?!
Susan
  #2  
Old December 11th, 2009, 02:01 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Need a query to get rid of duplicates using two tables

This sounds like you want to use the unmatched query wizard which will build a
query to find all records in one table that do not have a matching value in
another table.

The SQL of the query that will be built will look something like:

SELECT TableB.[Name]
FROM TableB LEFT JOIN TableA
ON TableB.[Name] = TableA.[Name]
WHERE TableA.[Name] is null

By the way, Name is a poor choice for a field name or table name or any other
object in Access. Everything has a NAME property and it is possible for
confusion to arise. I would suggest you use something like ClientName,
PersonName, TheName, ItemName, etc. to preclude any possible problems.

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Susan wrote:
I have 2 tables - one -A - has 100 records - the other - B - has 150
records - they have a common field NAME - table B has the same 100 records as
table A, plus 50 more - I want to create a table with only the 50 records
that are not unique to both tables. The tables I'm dealing with have much
more than 100 records so I need a query to take out the common records and
leave only the unique 50 records from table B. This is not the typical
"duplicate records" query as it relates to two tables. Help!?!
Susan

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.