关于导入凭证后再删除后未及时清理GL_CashTable 出现明细重复

如图:

 

---查询科目

select * from GL_CashTable where iyear=2023 and iYPeriod=202308 and ccode='100202' and iNo_id=2

select * from gl_accvouch where iyear=2023 and iperiod=8 and (ccode like '1001%' or ccode like '1002%')

--查询最大ID

select max(i_id),iSignSeq,iNo_id,inid,cCashItem,ccode from GL_CashTable where iyear=2023 and iYPeriod=202308

group by iPeriod,iSignSeq,iNo_id,inid,cCashItem,ccode


select * into gl_cashtable_20231017 from GL_CashTable where iyear=2023 and iYPeriod=202308 and ccode='100202' and iNo_id=2

select * from gl_accvouch where iyear=2023 and iperiod=8 and (ccode like '1001%' or ccode like '1002%')

select max(i_id),iSignSeq,iNo_id,inid,cCashItem,ccode from GL_CashTable where iyear=2023 and iYPeriod=202308 group by iPeriod,iSignSeq,iNo_id,inid,cCashItem,ccode

--清理非最大ID项
--delete from GL_CashTable where iyear=2023 and iYPeriod=202308 and i_id not in(select max(i_id) from GL_CashTable where iyear=2023 and iYPeriod=202308 group by iPeriod,iSignSeq,iNo_id,inid,cCashItem,ccode)

posted @ 2023-10-17 16:10  诚实间  阅读(44)  评论(0编辑  收藏  举报