[astrosword]:drop table temp go select 单号,SUM(耗用工时) as 协作总工时 into temp from 协作记录 where 单号 in (select 单号 from 工作日报明细 where 工作日报明细.总工时 is null or 工作日报明细.总工时=0) group by 单号 go update 工作日报明细 inner join temp on temp.单号=工作日报明细.单号 set 工作日报明细.总工时=[负责人工时]+[temp.协作总工时] 在以上语名句中,当工作日报明细.负责人工时不为0,而temp.协作总工时为空时,计算结果为0请问如何解决?谢谢!
——————————————————————————————————
[lcqhy]:第二条语句您可以改成: select 单号,IIF(SUM(耗用工时) IS NULL,0,SUM(耗用工时)) as 协作总工时 into temp from 协作记录 where 单号 in (select 单号 from 工作日报明细 where 工作日报明细.总工时 is null or 工作日报明细.总工时=0) group by 单号 您再试一下看是否能够解决。
——————————————————————————————————
[timeslong]:二楼的办法是否能解决,请共享一下信息