SELECT id, name
FROM a
WHERE id IN (SELECT MIN(id) FROM a GROUP BY name HAVING COUNT(*) > 1)
SQL找出重复的记录只显示一条记录
最新推荐文章于 2024-07-04 16:29:03 发布
SELECT id, name
FROM a
WHERE id IN (SELECT MIN(id) FROM a GROUP BY name HAVING COUNT(*) > 1)