Write a SQL query to find duplicate records in a customer table and keep only the latest record per customer. Use the customer_records table, treating the greatest updated_at value as latest. If timestamps tie, retain the row with the greatest record_id.
record_id, customer_id, customer_name, email, updated_at, and duplicate_count.customer_id ascending.| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique identifier for the stored customer record |
| customer_id | INT | Business identifier shared by records for the same customer |
| customer_name | VARCHAR(150) | Customer's full name |
| VARCHAR(255) | Customer email address | |
| updated_at | TIMESTAMPTZ | Timestamp when the customer record was last updated |