mysql查询名称重复的数据
查询所有重复数据:
SELECT * FROM your_table_name WHERE your_name IN ( SELECT your_name FROM your_table_name GROUP BY your_name HAVING COUNT(*) > 1 );
查询重复项,只保留第一条:
SELECT DISTINCT your_name FROM your_table_name WHERE your_name IN ( SELECT your_name FROM your_table_name GROUP BY your_name HAVING COUNT(*) > 1 );
查询列表中所有 name 去重数据:
SELECT your_name, MIN(id) as id FROM your_table_name GROUP BY your_name;