A
anags
Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
with CarMaintData.qryCarMaintdo
begin
sql.Clear;
S := 'update TpMain set StoreGross=StoreGross-View_TPOut_List.Gross,'
+ 'StoreExes=round((StoreGross-View_TPOut_List.Gross)*(TpMain.InPrice),2)'
+ ' from TPMain,View_TPOut_List ' +
'where (View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'') and (TPMain.PartNo=View_TPOut_List.PartNo)';
sql.Text := s;
Prepared;
ExecSQL;
S := 'update View_TPOut_List set costGross=StoreGross,'
+ 'costExes=StoreExes,CostPrice=TPMain.Inprice,View_TPOut_List.inprice=TPMain.Inprice,'
+ 'CostChangeExes=TPMain.Inprice*View_TPOut_List.gross'
+ ' from TPMain,View_TPOut_List ' +
'where (View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'') and (TPMain.PartNo=View_TPOut_List.PartNo)';
sql.Text := s;
Prepared;
ExecSQL;
end;
1.库存表TPMAIN ,视图表:View_TPOut_List
第一步是用某一委托书号(s1)下所有‘未出库’的配件来更新TPMain。
第二步用更新后的TpMain去更新View_TPOut_List.
2.此语句从理论上是否正确?
3.where后是先连接(TPMain.PartNo=View_TPOut_List.PartNo)还是先检索:(View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'');有区别吗?那个是正确的?那个效率高?
3。此语句有时执行结果不正确。视图TPOut_List是打开的,这样在一个基本表与视图之间互相更新可以吗?
with CarMaintData.qryCarMaintdo
begin
sql.Clear;
S := 'update TpMain set StoreGross=StoreGross-View_TPOut_List.Gross,'
+ 'StoreExes=round((StoreGross-View_TPOut_List.Gross)*(TpMain.InPrice),2)'
+ ' from TPMain,View_TPOut_List ' +
'where (View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'') and (TPMain.PartNo=View_TPOut_List.PartNo)';
sql.Text := s;
Prepared;
ExecSQL;
S := 'update View_TPOut_List set costGross=StoreGross,'
+ 'costExes=StoreExes,CostPrice=TPMain.Inprice,View_TPOut_List.inprice=TPMain.Inprice,'
+ 'CostChangeExes=TPMain.Inprice*View_TPOut_List.gross'
+ ' from TPMain,View_TPOut_List ' +
'where (View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'') and (TPMain.PartNo=View_TPOut_List.PartNo)';
sql.Text := s;
Prepared;
ExecSQL;
end;
1.库存表TPMAIN ,视图表:View_TPOut_List
第一步是用某一委托书号(s1)下所有‘未出库’的配件来更新TPMain。
第二步用更新后的TpMain去更新View_TPOut_List.
2.此语句从理论上是否正确?
3.where后是先连接(TPMain.PartNo=View_TPOut_List.PartNo)还是先检索:(View_TPOut_List.TomainID=''' + s1 + ''') and ' +
' (outstate=''未出库'');有区别吗?那个是正确的?那个效率高?
3。此语句有时执行结果不正确。视图TPOut_List是打开的,这样在一个基本表与视图之间互相更新可以吗?