Update/Append AND Delete combination?

  • Thread starter Thread starter Ida
  • Start date Start date
I

Ida

Hi there, I have been trying to solve the following the problem and was
wondering if anybody had a solution.

I have two tables, Table1 and Table2. Table2 is constantly changing and
is updated by the user. Both Tables share 1 common field or column.

All data in the single, common field from Table1 must be updated FROM
Table2.

How would I delete data or rows from Table1 that do not appear in
Table2 for a particular column??

Example: There are 4 rows in column A in Table2. There are 6 rows in
column A in Table1. As a result, there are 2 rows that are UNwanted in
Table1. How do I delete those 2 specific rows from Table1 ?

I figured out how to append new data and update existing data, but not
to delete them.

Thanks.
 
Ida said:
How would I delete data or rows from Table1 that do not appear in
Table2 for a particular column??

DELETE FROM Table1
WHERE NOT EXISTS (
SELECT *
FROM Table2
WHERE Table2.blah = Table1.blah)
 

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