解决方案: |
其他应收单部门出错的,用下面语句:
update ap_detail set cdeptcode=202 where auto_id in (11136,11140)
发票出错的用下面语句:
select auto_id,ibvid, a.cdepcode,b.cdeptcode,cprocstyle into aptemp
from (
select autoid,cdepcode from salebillvouch join salebillvouchs
on salebillvouch.sbvid=salebillvouchs.sbvid
)a
join
(select auto_id,ibvid,cdeptcode,cprocstyle from ap_detail where cflag='ar')b
on a.autoid=b.ibvid
where a.cdepcode<>b.cdeptcode
update ap_detail set aP_detail.cdeptcode=aptemp.cdepcode from ap_detail left join aptemp on ap_detail.auto_id=aptemp.auto_id
where ap_detail.cdeptcode<>aptemp.cdepcode
drop table aptemp
|