Problems / Conflicting Records Resolution / Editorial
billing
warehouse
order_id
b.order_id
w.order_id
COALESCE(b.order_id, w.order_id)
COALESCE(b.amount, w.amount)
source
CASE WHEN b.amount IS NOT NULL THEN 'billing' ELSE 'warehouse' END
b.order_id IS NOT NULL
Record resolution is a precedence rule, and the resolved value and its provenance label must be computed from the same predicate. COALESCE(b.amount, w.amount) encodes "billing wins when non-NULL"; the moment the source column encodes anything else — like "billing wins when the row exists" — the two columns can contradict each other. The dataset forces the distinction: orders in both systems with conflicting amounts (billing wins), orders in exactly one system, and an order present in billing whose amount is NULL (warehouse wins despite billing's presence).
Solve Conflicting Records Resolution yourself →