The Question
SQLRolling Window Duplicate Transaction Detection
Given a dataset of financial transactions, identify the number of 'accidental' repeat payments. A repeat payment is defined as a transaction that occurs at the same merchant, using the same credit card, for the same amount, within a 10-minute rolling window of a previous successful transaction. Ensure that only the subsequent (redundant) transactions are counted, excluding the initial valid payment from the total count.
Spark
Window Func
LAG
CTE
Timestamp Arithmetic
March 9, 2026