|
版本: |
|
小版本号: |
|
|
|
数据库: |
|
服务器操作系统: |
|
应用服务器: |
|
客户端操作系统: |
|
浏览器: |
|
|
|
本帖最后由 dh_n 于 2017-7-21 14:55 编辑
- select ERP_MM_StockPlanTemp.*,ERP_MM_BOMDetail.fRationNum as fRationNum,ERP_MeasurementUnit.fName as fName,ERP_StockArchives.fStockName as fStockName,ERP_StockArchives.fNormsType as fNormsType,ERP_WH_Summary.fbalanceAmount as fbalanceAmount,(select sum(ERP_PU_PurchaseList.fPurchaseNumber) as custom8 from ERP_PU_PurchaseList ERP_PU_PurchaseList optional join ERP_PU_BuyOrder ERP_PU_BuyOrder on ERP_PU_PurchaseList.fMainID = ERP_PU_BuyOrder where ERP_PU_PurchaseList.fStockCode = ERP_MM_StockPlanTemp.fMaterielCode AND ERP_PU_BuyOrder.fBillStatus = '批准' ) as custom7,(select sum(ERP_MM_ResourceAllocation.fAllotNumber) as custom10 from ERP_MM_ResourceAllocation ERP_MM_ResourceAllocation optional join ERP_PU_PurchaseList ERP_PU_PurchaseList on ERP_PU_PurchaseList.fStockCode = ERP_MM_ResourceAllocation.fMaterielCode optional join ERP_PU_BuyOrder ERP_PU_BuyOrder on ERP_PU_PurchaseList.fMainID = ERP_PU_BuyOrder where ERP_MM_ResourceAllocation.fResourcesNO = ERP_PU_BuyOrder AND ERP_MM_ResourceAllocation.fIsClose = '否' AND ERP_PU_PurchaseList.fStockCode = ERP_MM_StockPlanTemp.fMaterielCode ) as custom9,custom7 - custom9 as custom2
- from ERP_MM_StockPlanTemp ERP_MM_StockPlanTemp
- optional join ERP_MM_BOMMaster ERP_MM_BOMMaster on ERP_MM_StockPlanTemp.fPartNumber = ERP_MM_BOMMaster.fMaterielCode AND ERP_MM_BOMMaster.fDrawingVersion = ERP_MM_StockPlanTemp.fPartRev
- optional join ERP_MM_BOMDetail ERP_MM_BOMDetail on ERP_MM_BOMMaster = ERP_MM_BOMDetail.fMainID AND ERP_MM_BOMDetail.fMaterielCode = ERP_MM_StockPlanTemp.fMaterielCode
- optional join ERP_MeasurementUnit ERP_MeasurementUnit on ERP_MM_BOMDetail.fMainMeasurementUnitID = ERP_MeasurementUnit
- optional join ERP_StockArchives ERP_StockArchives on ERP_MM_StockPlanTemp.fMaterielCode = ERP_StockArchives.fStockCode
- optional join ERP_WH_Summary ERP_WH_Summary on ERP_MM_StockPlanTemp.fMaterielCode = ERP_WH_Summary.fStockCode
复制代码
custom2=coustom7-custom9 ksql编辑器里应该怎么写,类型为float |
-
|