📜  查询删除重复项 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:30.242000             🧑  作者: Mango

代码示例1
DELETE FROM dups a USING (
      SELECT MIN(ctid) as ctid, key
        FROM dups 
        GROUP BY key HAVING COUNT(*) > 1
      ) b
      WHERE a.key = b.key 
      AND a.ctid <> b.ctid