How would you write a SQL query to find duplicate records in a member transaction database?
Compare transactions using member, date, amount, transaction type, and external reference. Return duplicate combinations for valid members only.
member_number, transaction_date, amount, transaction_type, external_reference, and duplicate_count.member_number, transaction_date, and transaction_type.| Column | Type | Description |
|---|---|---|
| member_idPK | INT | Internal member identifier |
| member_number | VARCHAR(20) | Member-facing account identifier |
| first_name | VARCHAR(50) | Member first name |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction row identifier |
| member_id | INT | Referenced member identifier |
| transaction_date | DATE | Date the transaction occurred |
| amount | NUMERIC(12,2) | Transaction amount |
| transaction_type | VARCHAR(20) | Transaction classification |
| external_reference | VARCHAR(40) | Reference supplied by the originating system |