Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting duplicate records using 2 tables

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
DB= Access 97

Problem:
I have two tables, table_a and table_b.

table_a ->
contains 8700 non-duplicate records
table_b ->
contains 1700 non-duplicate records
table_b ->
contains 77 records that are also in table table_a

problem:
I want to match several columns in table_b to table_a and I want to say, if the row in table_a matches the row in table_b then delete that row from table_b

Solution: ????
can this be done in SQL? I am sure it can but my SQL is weak. I have tried several things, but with no luck.

thank you
 
Example 1:

Delete table_b.*
Where Exists
(Select * From table_a
Where col1=table_b.col1
And col2=table_b.col2
And col3=table_b.col3
ANd ...)

Example 2:

Delete b.*
From table_b b
Inner Join Table_a a
On b.col1=a.col1
And b.col2=a.col2
And b.col3=a.col3
And ... Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top