Write a query that aggregates monthly recovery amounts and calculates a rolling three-month average for PRA Group.
Use the recovery_payments table and include only rows with a posted status. For this exercise, the rolling average includes the current month and up to the two preceding months in the monthly result.
YYYY-MM.recovery_month, monthly_recovery, and rolling_three_month_avg.| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique recovery payment identifier |
| recovery_date | DATE | Date the payment was recorded |
| amount | DECIMAL(12,2) | Recovery amount |
| status | VARCHAR(20) | Payment processing status |