解决方案: |
具体脚本如下: --通过明细账和结算单子表,检查结算单表错误记录,并插入临时表 select a.id, a.q --into tempa from (select sum(iainquantity) as q, id from ia_subsidiary where (bflag = 0 or bflag = 2) and cvoutype in ('01','30') group by id)a left join (select sum(isvquantity) as q, irdsid from PurSettleVouchs where baccount = 1 group by irdsid)b on a.id = b.irdsid where a.q <> isnull(b.q,0) go --更新baccount字段为正确值 update pursettlevouchs set baccount = 1 where irdsid in (select id from tempa) go --删除临时表 drop table tempa go 执行以上脚本,做好数据备份。 |