我在sql server上写了一个查询。 这是查询..
INSERT INTO #TEMPR(
nQtyR ,
cBENoR ,
dBEDateR ,
nReceiveValueR ,
cRemarksR ,
nJobOrderDtlIdR ,
nSKUIdR ,
cSKUCodeR ,
cSKUDescriptionR,
nJobOrderIdR ,
cJobOrderNoR ,
nLocationIdR ,
LocCodeR,
nWtR ,
nVolR ,
cStatusR,
nASNIDR,
cPalletIDR )
SELECT SUM(WMS_InventoryTag.nCount) AS nQtyR,
ISNULL(WMS_OutTurnDtl.cBENo,'') as cBENoR,
WMS_OutTurnDtl.dBEDate as dBEDateR,
isnull(WMS_OutTurnDtl.nReceiveValue,0) as nReceiveValueR,
'' AS cRemarks,
WMS_JobOrderDtl.nJobOrderDtlId as nJobOrderDtlIdR,
WMS_SKUMst.nSKUId as nSKUIdR,
WMS_SKUMst.cSKUCode as cSKUCodeR,
WMS_SKUMst.cSKUDescription as cSKUDescriptionR,
WMS_JobOrder.nJobOrderId as nJobOrderIdR,
WMS_JobOrder.cJobOrderNo as cJobOrderNoR,
WMS_LoactionMst.nLocationId as nLocationIdR,
WMS_LoactionMst.nLocationCode AS LocCodeR,
WMS_JobOrderDtl.nWt as nWtR,
WMS_JobOrderDtl.nVol as nVolR,
WMS_JobOrder.cStatus as cStatusR,
WMS_JobOrderDtl.nASNID as nASNIDR,
WMS_OutTurnDtl.cPalletID as cPalletIDR
FROM WMS_InventoryTrans inner JOIN WMS_OutTurnDtl ON WMS_OutTurnDtl.nOutTurnDtlId = WMS_InventoryTrans.nOutTurnDtlId
INNER JOIN WMS_JobOrderDtl ON WMS_InventoryTrans.nJobOrderDtlId = WMS_JobOrderDtl.nJobOrderDtlId
INNER JOIN WMS_SKUMst ON WMS_JobOrderDtl.nSKUId = WMS_SKUMst.nSKUId
INNER JOIN WMS_JobOrder ON WMS_JobOrderDtl.nJobOrderId = WMS_JobOrder.nJobOrderId
INNER JOIN WMS_WarehouseMst ON WMS_WarehouseMst.nWarehouseId=WMS_JobOrder.nWarehouseId
INNER JOIN WMS_InventoryTag ON WMS_InventoryTrans.nInvTransId=WMS_InventoryTag.nInvTransId
INNER JOIN WMS_LoactionMst ON WMS_InventoryTag.nLocationId=WMS_LoactionMst.nLocationId
WHERE WMS_JobOrder.cStatus='A' AND WMS_InventoryTag.cStatus='A'
AND 1=case when isnull(@JOBID,'')='' then 1 else case when WMS_JobOrder.nJobOrderId=@JOBID then 1 else 0 end end
and 1=case when isnull(@CUSTID,'')='' then 1 else case when WMS_JobOrder.nCustomer=@CUSTID then 1 else 0 end end
and 1=case when isnull(@locID,'')='' then 1 else case when WMS_LoactionMst.nLocationId=@locID then 1 else 0 end end
and 1=case when isnull(@asnID,'')='' then 1 else case when WMS_JobOrderDtl.nASNID=@asnID then 1 else 0 end end
and WMS_JobOrder.nWarehouseId=@WAREHOUSEID
GROUP BY WMS_OutTurnDtl.cBENo, WMS_OutTurnDtl.dBEDate, isnull(WMS_OutTurnDtl.nReceiveValue,0),
WMS_JobOrderDtl.nJobOrderDtlId, WMS_SKUMst.nSKUId, WMS_SKUMst.cSKUCode, WMS_SKUMst.cSKUDescription,
WMS_JobOrder.nJobOrderId, WMS_JobOrder.cJobOrderNo,WMS_LoactionMst.nLocationId,WMS_LoactionMst.nLocationCode,WMS_JobOrder.cStatus,
WMS_JobOrderDtl.nWt,
WMS_JobOrderDtl.nVol,WMS_JobOrderDtl.nASNID,WMS_OutTurnDtl.cPalletID
ORDER BY WMS_JobOrder.nJobOrderId
但是当我执行此查询时,它会返回错误信息
多部分标识符“WMS_OutTurnDtl.cPalletID”不可能 界。
我知道该怎么做。
答案 0 :(得分:1)
检查WMS_OutTurnDtl表。并检查所有列是否正确