|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我发现,其实8楼的人数计算结果是错误的,有重复计数。现修改语句如下:
select [Current Sub-team],[OT Year],[OT Month],[OT Date],[Total(Hours)],0 as 人数 from(
select b.[Current Sub-team],b.[Staff ID],a.[OT Year],a.[OT Month],a.[OT Date],a.[Total(Hours)] from [Current staff$]b left join [OT Record$]a on a.[Staff NO]=b.[Staff ID] where b.[Staff ID] is not null) union all
select [Current Sub-team],0,0,0,0,count([Staff ID]) as 人数 from [Current staff$] group by [Current Sub-team] |
|