
You are comparing staged invoice data against ERP invoice records used in Valmont Industries finance reporting. Write a PostgreSQL query that surfaces discrepancy patterns by vendor and invoice month, including missing ERP matches, amount mismatches, date mismatches, and duplicate staged invoices.
One row per vendor and invoice monthCount reviewed staged invoicesCount total discrepanciesBreak out counts by discrepancy type