← Sales & Refund Reconciliation

Lesson 2 of 4

Resolve refund identity

Separate harmless retries from conflicting refund records.

Do the work

  1. refund_id is the business key; order_id alone is not, because partial refunds can share a sale.
  2. An exact repeat counts once. A conflicting field quarantines the entire key.
  3. Inspect all records for a key before selecting the reporting period.

See the method

Three identical copies of a receipt represent one refund.

Read every demonstration step
  1. Three identical copies of a receipt represent one refund.
  2. Two amounts under the same receipt ID are a conflict.
  3. DISTINCT over every column leaves both conflicting variants, so it is insufficient by itself.

Practice independently

Take it further

Add a conflict outside the reporting month and verify that its key is still quarantined.