从此SO POST Finding Duplicates中,如何删除重复项。
SELECT firstname, lastname, list.address FROM list
INNER JOIN (SELECT address FROM list
GROUP BY address HAVING count(id) > 1) dup ON list.address = dup.address
最佳答案
只需使用DISTINCT关键字:
SELECT DISTINCT firstname FROM list;
如果任何输出是重复的,mysql将删除它们。
有关DISTINCT的更多文档,请访问此处:
http://www.cyberciti.biz/faq/howto-removing-eliminating-duplicates-from-a-mysql-table/
关于mysql - 删除重复项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7655832/