0

I'm totally new to SQL, but I need to remove record from one table where they have a corresponding entry in another table. There are two cells that identify the record in both tables, Forwarder and Certificate #.

The SQL code that I think should work is:

DELETE *
FROM tblAgedDebtors
WHERE 'Forwarder' in (SELECT DISTINCT 'Forwarder' FROM tblCancellations)
AND 'Certificate #' in (SELECT DISTINCT 'Certificate #' FROM tblCancellations);

Though Access tries to delete every record when running this, possibly because the code doesnt specify that the Forwarder and Certificate # should be in the same record? I don't know.

Other questions that have been asked do explore this topic, but not when searching for two columns in the same row.

  • Here is a link to another stackoverflow page with the same question: http://stackoverflow.com/questions/1590799/delete-all-rows-in-a-table-based-on-another-table You can also check this link: http://stackoverflow.com/questions/1783784/sql-delete-rows-based-on-another-table – ctwheels Jul 29 '14 at 14:05
  • @ctwheels I actually got the query I tried from the second link, and the first link didn't seem too dissimilar, however neither of them appear to tackle my issue of checking two columns at the same time. – user3805867 Jul 29 '14 at 14:12

0 Answers0