解决方案: |
查询语句如下供参考:
Select iperiod,mb as 金额期初,md as 借,mc as 贷,*
From gl_accass
where cdept_id=‘0109‘ and ccode=‘122‘ and iperiod in (‘2‘,‘3‘) and ccus_id is null
order by ccus_id
但是查询科目122是带客户往来的,而在辅助总帐中又存在客户辅助项为空的非法记录,查询科目(带客户往来)但辅助总帐中客户辅助项为空的所有非法数据:
Select * From gl_accass a join code b on a.ccode=b.ccode
where a.ccus_id is null and b.bcus=1
恢复凭证记帐至1月份期初状态,再执行下列删除语句删除非法记录,
delete from gl_accass where i_id in (Select a.i_id From gl_accass a join code b on a.ccode=b.ccode
where a.ccus_id is null and b.bcus=1)
重新对1-4月份凭证记帐即可。 |