dm7根据部分字段去重

delete from test.cf where (FDMCHXM,TYSHXYDM) IN 
(SELECT FDMCHXM,TYSHXYDM FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1)
AND ROWID  not IN (SELECT MIN(ROWID) FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1);

 

说明:

重复数据总量=
重复数据量
select COUNT(*) from test.cf 
where (FDMCHXM,TYSHXYDM) 
in(select  fdmchxm,TYSHXYDM FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1)
AND ROWID NOT IN (SELECT MIN(ROWID) FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1);
+
重复数据量去重后数据量
select COUNT(*) from test.cf 
where (FDMCHXM,TYSHXYDM) 
in(select  fdmchxm,TYSHXYDM FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1)
AND ROWID  IN (SELECT MIN(ROWID) FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)>1);

总数据量=
没有重复数据量
select COUNT(*) from test.cf 
where (FDMCHXM,TYSHXYDM) 
in(select  fdmchxm,TYSHXYDM FROM TEST.CF GROUP BY FDMCHXM,TYSHXYDM HAVING COUNT(1)=1)
+重复数据总量

你可能感兴趣的:(dm)