GROUP BY composite key + HAVING for anomaly detection
AP ran a duplicate payment scan — find any (vendor_id, amount, txn_date) triples that appear more than once. Posted only. Columns: `vendor_id`, `txn_date`, `amount`, `occurrences`. Usually zero, but we've had scares.
Each hint you reveal reduces the XP you can earn. Try the query first.
GROUP BY (vendor_id, txn_date, amount) on fact_transactions where posted = 1.
HAVING COUNT(*) > 1.
Alias COUNT(*) as `occurrences`.