Delete Records From One Table that are Duplicated in Another

G

Gwen H

I've looked at similar posts here, and I still can't get the following query
to work. I am trying to delete all records from the Ignore_This_Table table
where the loan number in those records matches a loan number in the
Loan_Activities table. Here is my SQL.

DELETE *
FROM Ignore_This_Table
WHERE Ignore_This_Table.Loan# = Loan_Activities.Loan#

I've tried to use other examples posted here to make it work, but I keep
getting error messages. What is wrong with my SQL?

Many, many thanks,
Gwen H
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Like this:

DELETE *
FROM Ignore_This_Table
WHERE Ignore_This_Table.Loan# IN (SELECT Loan# FROM Loan_Activities)

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQkw6p4echKqOuFEgEQKSDwCfUbBESgoOBiXgEmD8hYroAVNxHoAAoI2c
ZmhIaAJUAf+kvm5fQr7HOdkT
=Nj7m
-----END PGP SIGNATURE-----
 
G

Gwen H

Never mind, I was trying to do it the hard way. All I had to do was set up a
delete query with the two tables in it. I linked them on the Loan# field. I
specified Ignore_This_Table as the From table by double-clicking the asterisk
to add all the fields to the query, then selected From in the "Delete" box.
Then I added the Loan# field from the Loan_Activities table, and selected
Where in the "Delete" box. Now it works like magic!

GwenH
 
B

Bill_S

Gwen,
I tried this and it won't work for me. I get the message "Could not delete
from specified tables." Any help?

thanks, Bill
 
V

Van T. Dinh

Your error message indicates Access / JET think there are 2 Tables involved
in the SQL.

Post your Table Structure and the SQL String of your Query.
 
Top