On Wed, 12 Dec 2007 06:40:01 -0800, Ernest Monterrosa <Ernest
(E-Mail Removed)> wrote:
>How to delete "non-identical" duplicate records in an Access Table? Where
>"non-identical" duplicate record means a record in the table that has
>slightly different datum in one of the fields, but an identical duplicate
>datum in the field that I am concerned with. For example:
>SSN MRN CLIENT NAME
>001-00-2222 11170419 Smith, Jane
>001-00-2222 11170419 Smith, Jane T
>001-00-2222 11170419 Smith, Jane Thompson
>
>The data of these two records in the fields SSN and MRN are identical; but
>"non-identical" in the CLIENT NAME field (notice the T and Thompson in
>the second and third row)
>I am concerned with MRN field, and I consider these two records a duplicate
>because the MRN data is identical.
>
>I need to know a way in Access to delete all non-identical records EXCEPT
>ONE.
possibly:
SSN MRN Client Name
001-00-2222 11170419 Smith, Jane
001-00-2222 11170419 Smith, Jane T.
001-00-2222 11170419 Smith, Jane Thompson
002-01-3333 22220519 Mouse, Mickey
002-01-3333 22220519 Mouse, Micky
002-01-3333 22220519 Mouse, Michael
003-03-1234 33311999 Thomas, Bart
DELETE *
FROM Table1
WHERE [Client Name] In (
SELECT b.[Client Name] FROM Table1 AS a
INNER JOIN Table1 AS b
ON len(a.[Client Name]) > len(b.[Client Name])
AND a.SSN = b.SSN
AND a.MRN = b.MRN);
SSN MRN Client Name
001-00-2222 11170419 Smith, Jane Thompson
002-01-3333 22220519 Mouse, Michael
003-03-1234 33311999 Thomas, Bart