HANA删除重复记录的方法

时间:2023-02-01 06:25:51

HANA删除重复记录的方法

对于未建主键的表出现重复记录需要删除时,可以利用"$rowid$"进行区分并做处理

delete from TESTA WHERE testid IN (
( SELECT testid FROM TESTA GROUP BY testid HAVING COUNT(testid) > 1) AND "$rowid$" NOT IN
(SELECT MIN("$rowid$") FROM TESTA GROUP BY testid HAVING COUNT(*) > 1);