SELECT
0 AS Shift_ID,
Waybill_ProductTypeID,
cast(COUNT(1) as decimal) AS CalculateCount,
SUM(WaybillGood_CalculateWeight) AS CalculateWeight,
cast(sum((isnull(Waybill_Weight,0)/Waybill_PredictPackageCount)) as decimal(12,2)) as [Weight],
5 AS Stage --没有预计车次的在库
FROM dbo.WaybillGood
INNER JOIN Waybill ON Waybill_ID = WaybillGood_WaybillID
WHERE WaybillGood_StationID =@StationID and WaybillGood_ShiftID = 0 and WaybillGood_SupplierCommissionID =0 AND WaybillGood_LastCheckIOTime > '2016-01-01 8:00:00'
GROUP BY Waybill_ProductTypeID
=================
这个还可以优化吗