Taking records out of one table based on another using a query?

maddoxx

New member
Local time
Today, 12:21
Joined
Mar 8, 2002
Messages
8
I have two tables. One table has 27,000 records, the other 90,000. The 27K came from the original 90K list.

What I would like to do is make a query that takes the 27K records out of the 90K list, which would bring the record count down to 63 thousand.

I'm sure I can use a query to do this, but I'm just not sure how to do it. All the records in both tables have an ID number (key) that could be used to compare the values of both lists.

Any help on this would be most appreciated.

Thank you sincerely,

JIM
 
Let's say your 27K table is called Table1,
your 90K table is called Table2, the unique relation between both tables is defined by ID number.

Try this:

DELETE
FROM Table2
WHERE Table2.[ID Number]=
(SELECT Table1.[ID Number]
FROM Table1);

Make a copy of both tables first before running the statement or run a select statement first to be absolutely sure you don't delete records you shouldn't...

SELECT *
FROM Table2
WHERE Table2.[ID Number]=
(SELECT Table1.[ID Number]
FROM Table1);

Suc6,

RV
 

Users who are viewing this thread

Back
Top Bottom