我已使用此代码选择重复的行,它正确了,
SELECT name, COUNT(name)
FROM emp
GROUP BY name
HAVING COUNT>1;
但是删除相同的所选行并没有帮助我。...
DELETE emp
WHERE name IN ( SELECT name, COUNT(name)
FROM emp
GROUP BY name
HAVING COUNT >1);
答案 0 :(得分:0)
从内部SELECT
删除第二列,如下所示:
DELETE
FROM emp
WHERE name IN( SELECT name FROM emp GROPU BY name HAVING COUNT(name) > 1)