
You are given two related financial datasets that should align, but they contain discrepancies. Explain how you would use PostgreSQL SQL to reconcile them, identify the root causes of differences, and produce an output that a finance reviewer could use to investigate exceptions.
Matching records across datasets with joinsStandardizing fields before comparisonAggregating to the correct reconciliation grainClassifying discrepancies with `CASE WHEN`Structuring logic clearly with CTEsThink of comparing ERP transactions, subledger activity, and BlackLine-supported reconciliation outputs. The goal is not only to find differences, but to separate missing records, duplicates, timing issues, and amount mismatches in a way that is auditable.