If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
delete duplicates
I have one table (table 1) with a column A & B and another table (table 2)
with columns C & D. Now there are duplicates in table 2 on the values in column C. I need to keep the entries where 1A=2C and 1B=2D and delete the entries where 1A=2C and 1B does not = 2D please help |
#2
|
|||
|
|||
delete duplicates
So you want to keep the entries where Table1.A = Table2.B and Table1.C =
Table2.D, and delete the non-matching entries from table1? DELETE FROM Table1 WHERE NOT EXISTS (SELECT B FROM Table2 WHERE Table1.A = Table2.B and Table1.C = Table2.D); If subqueries are new, here's an introduction: http://allenbrowne.com/subquery-01.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Darren" wrote in message ... I have one table (table 1) with a column A & B and another table (table 2) with columns C & D. Now there are duplicates in table 2 on the values in column C. I need to keep the entries where 1A=2C and 1B=2D and delete the entries where 1A=2C and 1B does not = 2D please help |
Thread Tools | |
Display Modes | |
|
|