how to delete matched records?

G

Geoff Cox

Hello,

I have table A with say 200 names in it and a second table B with say
40 names in it.

I would like to compare the 2 tables and delete in A any name which
appears in B.

How to do this?!

Cheers

Geoff
 
P

Pieter Wijnen

DELETE From A
WHERE Exists (Select 'X' From B WHERE B.LinkField=A.LinkField)

Pieter
 
D

Dale Fye

Are you absolutely certain that "John Doe" in table A is the same person as
"John Doe" in table B, or is that Jonathan Doe in table B?

You've got to be careful doing this type of thing with a query. When you
are using ID values that is one thing, but any time you compare names you
have to be careful that you use some other parameter (phone, address, dob,
....) as well to do the matching (if you have one) .

Dale
 
G

Geoff Cox

DELETE From A
WHERE Exists (Select 'X' From B WHERE B.LinkField=A.LinkField)

Thanks Pieter,

being new at this - how do I implement the above?!

Cheers

Geoff
 
G

Geoff Cox

DELETE From A
WHERE Exists (Select 'X' From B WHERE B.LinkField=A.LinkField)

Pieter,

I should also ask what 'X' is?

Presumably LinkField is the name of the field with the names in it?

Cheers

Geoff
 
G

Geoff Cox

DELETE From A
WHERE Exists (Select 'X' From B WHERE B.LinkField=A.LinkField)

Pieter,

I have got it working so many thanks.

I had to use [A] etc then it was OK.

Cheers

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top