Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008

    Unanswered: Compairing tables for duplicate records and increment

    I believe somebody may have done this. I have two tables to compare for duplicates. Say 'tblA" and "tblB". Both tables have the same unique key (link). I want to cmpair both tables and if duplicate record is found, I will like to keep the record in tblA and increment the record in tbl with next available number. For example here is the sample table data: Please can some body direct me for solution. I am sorry not to identify the unique. Unique key is the "ID". Here are the fields. ID, Field1, Field2. For example field2 in both tblA and tblB may have the same data like ID=A10109, field2 = A10109Z3.Where thi is found, I want to keep the data in tblA as is and change field2 data in tblB to any available "Z"(Z1,z2,Z3,....Zn)suffix that is not found in tblA. for example like A10109Z3 will change or increase to A10109Z4. I hope this will help.

    id Field1 Field2
    A10109 MC A10109
    A10109 MC A10109Z
    A10109 MC A10109Z2
    A10109 MC A10109Z3
    A10109 MC A10109Z4
    A10113 MC A10113Z
    A10113 MC A10113Z2
    A10140 MC A10140Z
    A10175 MC A10175Z
    A10175 MC A10175Z2
    A10217 MC A10217Z
    A10223 MC A10223Z

    ID Field1 Field2
    A10109 CO A10109Z1
    A10109 CO A10109Z2
    A10109 CO A10109Z3
    A10113 CO A10113Z1
    A10113 CO A10113Z2
    A10175 CO A10175Z1
    A10175 CO A10175Z2
    A10175 CO A10175Z3
    A10175 CO A10175Z4
    Last edited by osimini; 11-09-11 at 11:15.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    Use the Find Duplicates Query Wizard.
    Have a nice day!

  3. #3
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 7
    The Find Duplicates Query Wizard works by finding duplicates within a single column. To use it here, you'd first need a union query of both tables.

    The other problem is that unless you impose a sort order on the results, the duplicates found will be in any order, so you will not know which one needs to be updated.
    10% of magic is knowing something that no-one else does. The rest is misdirection.
    Beers earned: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts