解决方案: |
若该单据确已在以前年度记过帐,执行以下语句即可:
update rdrecord
set caccounter=‘吴真‘
where id in
SELECT rdrecord.id
FROM Warehouse INNER JOIN Rd_Style RIGHT JOIN RdRecord ON Rd_Style.cRdCode = RdRecord.cRdCode
ON Warehouse.cWhCode = RdRecord.cWhCode INNER JOIN RdRecords ON RdRecord.ID = RdRecords.ID
INNER JOIN Inventory ON RdRecords.cInvCode = Inventory.cInvCodeleft join dispatchlists
on rdrecords.idlsid=dispatchlists.idlsid
left join dispatchlist on dispatchlists.dlid=dispatchlist.dlid
left join salebillvouchs sales1 on dispatchlists.idlsid=sales1.idlsid
left join salebillvouch sale1 on sales1.sbvid=sale1.sbvid
left join salebillvouchs sales2 on rdrecords.isbsid=sales2.autoid
left join salebillvouch sale2 on sales2.sbvid=sale2.sbvid
Where IsnullRdRecords.iQuantity,0<>0 And RdRecord.cAccounter IS NULL and sale1.caccounter is null
and sale2.caccounter is null and sale1.cinvalider is null
and sale2.cinvalider is null and isnullrdrecord.cbustype,‘‘<>‘委托代销‘
and cMonth is null or rightcMonth,2<2 and rdrecord.cVouchType<>‘33‘
and not rdrecord.cVouchType=‘32‘ or rdrecord.cvouchtype=‘34‘
and ISNULLSALES1.IDLSID,0=0 AND ISNULLRDRECORDS.ISBSID,‘‘=‘‘
and RdRecord.cVouchType=‘32‘ and not rdrecords.isbsid is null OR not sales1.autoid is null
or RdRecord.cVouchType=‘34‘ and RdRecord.caccounter is null and RdRecord.dDate <= ‘2004-02-29‘ |