解决方案: |
问题1由于数据中从2004年存在3张日期异常单据(其他应收单)造成,可通过下面语句查询: select * from ufdata_001_2004..ap_detail where iFlag<>4 and (iperiod='0' and cPZID is null) and cflag='ar' and ((dPZDate<=N'2006-01-31' and dRegDate>N'2006-01-31') or (dPZDate>N'2006-01-31' and dRegDate<=N'2006-01-31') or (dPZDate>N'2006-01-31' and dRegDate>'2006-01-31')) select * from ufdata_001_2004..ap_vouch where cvouchtype='r0' and cvouchid in ('0000005168','0000004687','0000002614') 请根据实际业务更新或在期初界面中删除即可。 问题2是由于在Department表中删除部门但未在工资分摊设置表WA_GZsumComCfg中删除该部门导致,通过下面语句可以查询: SELECT WA_GZsumComCfg.iJT_id, WA_GZsumComCfg.iPsnGrd_id, WA_grade.cPsnGrd, WA_GZsumComCfg.iGZItem_id, WA_GZtblset.cSetGZItemName, WA_GZsumComCfg.cDebit, WA_GZsumComCfg.cCreditSide, WA_GZsumComCfg.cDepCode, Department.cDepName FROM ((WA_GZsumComCfg LEFT JOIN Department ON WA_GZsumComCfg.cDepCode = Department.cDepCode) LEFT JOIN WA_GZtblset ON WA_GZsumComCfg.iGZItem_id = WA_GZtblset.iGZItem_id) LEFT JOIN WA_grade ON WA_GZsumComCfg.iPsnGrd_id = WA_grade.iPsnGrd_id WHERE --WA_GZsumComCfg.cGZGradeNum='001' AND iJT_id=1 and Department.cDepCode is null GROUP BY WA_GZsumComCfg.iJT_id, WA_GZsumComCfg.iPsnGrd_id, WA_grade.cPsnGrd, WA_GZsumComCfg.iGZItem_id, WA_GZtblset.cSetGZItemName, WA_GZsumComCfg.cDebit, WA_GZsumComCfg.cCreditSide, WA_GZsumComCfg.cDepCode, Department.cDepName 请作好备份后执行下面语句调整即可: ---- delete from WA_GZsumComCfg where cDepCode='50' |