我有一个表,它填充了重复的行。我需要删除所有重复的行来刷新表。我可以用写作程序来做。它有什么最快的方式吗?
答案 0 :(得分:0)
DELETE MyTable
FROM MyTable
LEFT OUTER JOIN (
SELECT MIN(RowId) as RowId, Col1, Col2, Col3
FROM MyTable
GROUP BY Col1, Col2, Col3
) as KeepRows ON
MyTable.RowId = KeepRows.RowId
WHERE
KeepRows.RowId IS NULL