MS ACCESS - flag duplicates in to the same table
Posted on 2010-11-09
(1) My ACCESS Table1 has following columns, i.e., Field1, Field2, Field3, ..., Field 10 with 750,000 records.
(2) FIELD2 is supposed to contain unique value, but somehow there are over 10,000 duplicate values in it. I found this by using
SELECT Table1.FIELD2, count(Table1.FIELD2) as CheckDupe from Table1 group by 1 where CheckDupe>1
I'd like to find an effective way to
(A) Make Table1 to have extra column FIELD11 as a flag
(B) FIELD11 = "Yes" If FIELD2 contains duplicate value and "No" when it contains unique value?
I am just an intermediate MS ACCESS level. I found that the following solution would work, but very inefficient ie.,
(i) Make a text list of dupe values in MS WORD "Value1", "Value2", ...., "Value10000"
(ii) Create an intermediate table (called Table2) from Table1 that contain only 2 fields, i.e., FIELD2 and FIELD11, where as FIELD11 = ""
(iii) write an UPDATE query like this:
UPDATE TABLE2 SET TABLE2.FIELD11 = "Yes"
WHERE TABLE2.FIELD2 IN ("Value1", "Value2", ... , "Value1000");
(iv) run this query. then replace the next thousand values, save and run. then redo this again . . . . until all 10,000 values are covered.
The problem is 1. I have 5 other tables that have the same problem. I dont want to spend the whole week doing this. So, Help please.