W
WilliamGui
Unregistered / Unconfirmed
GUEST, unregistred user!
如何修改SQL,注释去掉也能执行
select top 1 1
from InStkDtl d inner join InStkMst m on d.InStkMstID=m.InStkMstID
inner join (
select sbd.DocMID, sbd.DocID, sum(sbd.Qty*sbd.CntRateNum/sbd.CntRateDen) StkBatchDocQty
from StkBatchDoc sbd
--where sbd.DocMID=d.InStkMstID and sbd.DocID=d.InStkDtlID
group by sbd.DocMID, sbd.DocID
) tsbd on tsbd.DocMID=d.InStkMstID and tsbd.DocID=d.InStkDtlID
where d.InStkMstID=d.InStkMstID and ((d.InStkQty*d.CntRateNum/d.CntRateDen)<>tsbd.StkBatchDocQty)
select top 1 1
from InStkDtl d inner join InStkMst m on d.InStkMstID=m.InStkMstID
inner join (
select sbd.DocMID, sbd.DocID, sum(sbd.Qty*sbd.CntRateNum/sbd.CntRateDen) StkBatchDocQty
from StkBatchDoc sbd
--where sbd.DocMID=d.InStkMstID and sbd.DocID=d.InStkDtlID
group by sbd.DocMID, sbd.DocID
) tsbd on tsbd.DocMID=d.InStkMstID and tsbd.DocID=d.InStkDtlID
where d.InStkMstID=d.InStkMstID and ((d.InStkQty*d.CntRateNum/d.CntRateDen)<>tsbd.StkBatchDocQty)