Delete Records From One Table that are Duplicated in Another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
-----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-----
 
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
 
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
 
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.
 

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

Back
Top