Docs
Browse Docs
Field guide · Duplicates

Duplicate keys with conflicting values

Two rows share an identifier that should be unique, but disagree on other fields.

What it looks like

Before
customer_idemailcityupdated
C-104lena.park@example.comRichmond2023-06-01
C-104lena.park@example.comNorfolk2024-02-10
C-221omar.haddad@example.comDurham·
C-221o.haddad@example.comDurham·
After
customer_idemailcityupdated
C-104lena.park@example.comNorfolk2024-02-10
C-221omar.haddad@example.comDurham·
C-221o.haddad@example.comDurham·
For C-104 the agreed rule is that the later update wins, and the earlier row is kept in the history. C-221 has no dates, so nothing says which email is current. Both rows stay until a person decides.

How it happens

  • A record was changed in one copy of the data and not in another, and the copies were later combined.
  • An update was stored as a new row instead of replacing the old one.
  • The same identifier was issued twice, so the rows describe two different things.

What it breaks

  • Joins multiply rows, so every total downstream is inflated.
  • Which value a report shows depends on row order, and can change from one run to the next.
  • Loading into a table with a unique key either fails or silently keeps whichever row came last.

How to spot it

  • Group by the key and count. Any key with more than one row is a candidate.
  • Within each group, list the columns where values differ. One changed field suggests an update, many suggest two different entities.
  • Check for a timestamp or version column that orders the rows.

How to fix it

  • Work out whether the rows are versions of one record or two records sharing an identifier by mistake. The repairs are different.
  • For versions, state the rule that picks the surviving value, such as the most recent update or the most trusted source, and apply it field by field.
  • Where no rule settles a field, send it to a person instead of keeping whichever row happens to come first.
  • Keep the rows that lost. They are the only record of what the conflict was.

TermsPrimary key, Survivorship, Golden record, Source of truth

Karg checks for many of these when it profiles a file, applies the fixes it is confident about, and sets the rest aside for your review. See how it works, or have our team clean your data for you.