Re: How get records not in another table?
- From: John Spencer <spencer@xxxxxxxxx>
- Date: Thu, 24 Apr 2008 08:21:57 -0400
John,
Small correction to your example. The Join was in the wrong direction, what you posted would probably show no records (assuming that ID is a required field)
SELECT <whatever you want to see>
FROM bigtable RIGHT JOIN smalltable
ON bigtable.ID = smalltable.ID
WHERE bigtable.ID IS NULL;
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
John W. Vinson wrote:
On Wed, 23 Apr 2008 17:53:00 -0700, mscertified <rupert@xxxxxxxxxxxxx> wrote:.
I need to list the records in one table (8,000 rows) that are NOT in another table (40,000 rows).
I tried SELECT ... WHERE NOT IN (SELECT...) but it took forever to run and I had to cancel the query.
The Query design window has an "Unmatched Query" wizard which does exactly
this. To roll your own, use a "frustrated outer join" query like
SELECT <whatever you want to see>
FROM bigtable LEFT JOIN smalltable
ON bigtable.ID = smalltable.ID
WHERE bigtable.ID IS NULL;
- Follow-Ups:
- Re: How get records not in another table?
- From: John W . Vinson
- Re: How get records not in another table?
- References:
- How get records not in another table?
- From: mscertified
- Re: How get records not in another table?
- From: John W . Vinson
- How get records not in another table?
- Prev by Date: Re: Dlookup inside IIf in 2 Table Update Query
- Next by Date: Re: How to find out the difference between two tables?
- Previous by thread: Re: How get records not in another table?
- Next by thread: Re: How get records not in another table?
- Index(es):
Relevant Pages
|