在我的表中有很多重复的行。我有一个SELECT,提供我想要删除的数据,但我该怎么做?无论我尝试什么,我都会收到错误。
SELECT *
FROM tablename t
WHERE NOT EXISTS (
SELECT 1
FROM tablename t2
WHERE t2.column = t.column
HAVING COUNT(*) = 1
)
答案 0 :(得分:0)
只需将'SELECT *'更改为'DELETE'
即可DELETE
FROM tablename t
WHERE NOT EXISTS (
SELECT 1
FROM tablename t2
WHERE t2.column = t.column
HAVING COUNT(*) = 1
)