Meta's business analytics team is reviewing lead data captured from Meta Lead Ads. Some leads were submitted multiple times for the same ad, and you need to identify those duplicate records and show how you would remove them while keeping one record per duplicate group.
Write a SQL query to find duplicate lead submissions, where a duplicate is defined as the same ad, email, and submission date. Keep the earliest lead_id as the canonical record.
lead_submissions.ad_campaigns.ROW_NUMBER().campaign_name, submission_date, email, and lead_id.| Column | Type | Description |
|---|---|---|
| lead_idPK | INT | Unique lead submission identifier |
| ad_id | INT | Ad identifier associated with the lead |
| VARCHAR(255) | Lead email address | |
| full_name | VARCHAR(255) | Lead full name |
| submission_date | DATE | Date the lead was submitted |
| source_surface | VARCHAR(100) | Meta surface where the lead was captured |
| Column | Type | Description |
|---|---|---|
| ad_idPK | INT | Unique ad identifier |
| campaign_name | VARCHAR(255) | Campaign name for the ad |
| objective | VARCHAR(100) | Campaign objective |