Write a SQL query to find all duplicate loan applications submitted within the last 24 hours.
Treat applications as duplicates when they share the same applicant_id, loan_type, and requested_amount. Include only groups with at least two applications submitted during the rolling 24-hour period.
applicant_id, loan_type, requested_amount, and duplicate_countduplicate_count descending, then applicant_id ascending, with NULL applicant IDs last| Column | Type | Description |
|---|---|---|
| application_idPK | INT | Unique loan application identifier |
| applicant_id | VARCHAR(20) | Applicant identifier |
| loan_type | VARCHAR(30) | Requested loan category |
| requested_amount | DECIMAL(12,2) | Requested loan amount |
| submitted_at | TIMESTAMPTZ | Timestamp when the application was submitted |