select count(1), gsdm, id
from ods_sc.T_D_DEVICE_COMMON
group by gsdm, id
having count(1) > 1;
delete from ods_sc.T_D_DEVICE_COMMON
where rowid in
(select a.rowid
from ods_sc.T_D_DEVICE_COMMON a, ods_sc.T_D_DEVICE_COMMON b
where a.gsdm = b.gsdm
and a.id = b.id
and a.rowid < b.rowid);
commit;
可以在测试环境试试这个语句。