Update ShipWorkDone_3 a
Set (LoadSum,PlanLoadSum,TimeSum,TotalTimeSum,TotalWeightTime,TotalDayTimeSum,TotalCraneNum)=
(
Select Sum(DayLoad) as LoadSum,
case when (PlanWorkCount-Case When SUM(DayLoad) Is Null Then 0 Else SUM(DayLoad) End )< 0 then 0 else (PlanWorkCount-Case When SUM(DayLoad) Is Null Then 0 Else SUM(DayLoad) End ) end as PlanLoadSum,
sum(DayWorkTime) as TimeSum, sum(WorkTime) as TotalTimeSum,sum(DayWeightTime) as TotalWeightTime,
SUM(DayTime) as TotalDayTimeSum,SUM(DayCraneNum) as TotalCraneNum
From WorkDayInfo_3 b,ShipWorkDone_3 c
Where b.ApplyID=c.ApplyID And b.BerthShiftTimes=c.BerthShiftTimes
And b.ApplyID=a.ApplyID And b.BerthShiftTimes=a.BerthShiftTimes
And b.ApplyID=A_ApplyID And b.BerthShiftTimes=B_BerthShiftTimes
Group By b.ApplyID,b.BerthShiftTimes,c.ApplyID,c.BerthShiftTimes
)
Where a.ApplyID=A_ApplyID And a.BerthShiftTimes=B_BerthShiftTimes;请教该如何改,才能正确
Set (LoadSum,PlanLoadSum,TimeSum,TotalTimeSum,TotalWeightTime,TotalDayTimeSum,TotalCraneNum)=
(
Select Sum(DayLoad) as LoadSum,
case when (PlanWorkCount-Case When SUM(DayLoad) Is Null Then 0 Else SUM(DayLoad) End )< 0 then 0 else (PlanWorkCount-Case When SUM(DayLoad) Is Null Then 0 Else SUM(DayLoad) End ) end as PlanLoadSum,
sum(DayWorkTime) as TimeSum, sum(WorkTime) as TotalTimeSum,sum(DayWeightTime) as TotalWeightTime,
SUM(DayTime) as TotalDayTimeSum,SUM(DayCraneNum) as TotalCraneNum
From WorkDayInfo_3 b,ShipWorkDone_3 c
Where b.ApplyID=c.ApplyID And b.BerthShiftTimes=c.BerthShiftTimes
And b.ApplyID=a.ApplyID And b.BerthShiftTimes=a.BerthShiftTimes
And b.ApplyID=A_ApplyID And b.BerthShiftTimes=B_BerthShiftTimes
Group By b.ApplyID,b.BerthShiftTimes,c.ApplyID,c.BerthShiftTimes
)
Where a.ApplyID=A_ApplyID And a.BerthShiftTimes=B_BerthShiftTimes;请教该如何改,才能正确
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货