LMSouq
database Open

Delete all Duplicate Rows except for One in MySQL?

HI
Highway of Life
1 month ago
3 views
Problem Description
How would I delete all duplicate data from a MySQL Table? For example, with the following data: SELECT * FROM names; +----+--------+ | id | name | +----+--------+ | 1 | google | | 2 | yahoo | | 3 | msn | | 4 | google | | 5 | google | | 6 | yahoo | +----+--------+ I would use `SELECT DISTINCT name FROM names;` if it were a `SELECT` query. How would I do this with `DELETE` to only remove duplicates and keep just one record of each?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base