账单明细表 创建唯一索引
CREATE UNIQUE ASCENDING INDEX I_ACCBILLSITEMS_SRCACTID ON ACCBILLSITEMS (SYSID, SRCACTID, SRCENTITYID, SRCLINENO)
---------
查询重复记录:
select a.sysid ,a.srcactid , a.srcentityid, a.srclineno from accbillsitems a,accbillsitems b
where a.sysid=b.sysid and a.srcactid=b.srcactid and a.srcentityid=b.srcentityid and a.srclineno=b.srclineno
group by a.sysid ,a.srcactid , a.srcentityid, a.srclineno
having count(a.itemid)>1