Rows to Keep After Deduplication
Medium
Duplicates & Deduplication
Keep only the row with the lowest id for each email. Return the id and email of the rows that survive, ordered by id. (This is the SELECT behind the usual DELETE.)
Table schema
Users(id INT PRIMARY KEY, email VARCHAR(30))Sample data
id | email
1 | a@x.com
2 | b@x.com
3 | a@x.com
4 | c@x.com
5 | b@x.com
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.