同样的se\ect 命令。但是SQL查询出来的结果和 fill到表格的结果确不同,这是什么原因呢?
SQL查询:
se\ect 姓名,sum(ISNULL(人天,0)) as 人天, sum(ISNULL(超期人天,0)) as 超期人天 from (Se\ect 姓名,case when 转移 > '1' then 当月人天 else 0 end as 超期人天 ,case when 转移 is null or 转移<=1 then 当月人天 else 0 end as 人天 ,转移 from {XMFP} Inner JOIN {人员信息表} ON {人员信息表}.[姓名] = {XMFP}.[成员] Inner JOIN {XMZB} ON {xmZB}.[BH] = {XMFP}.[BH] Where 成员='AA' and 任务开始 >= '2020-07-01' and 任务开始 <= '2020-07-31' and 代号 <> '练习')CQ group by 姓名
窗口表fill:
Dim dyrt As String ="se\ect 姓名,sum(ISNULL(人天,0)) as 人天, sum(ISNULL(超期人天,0)) as 超期人天 from (Se\ect 姓名,case when 转移 > '1' then 当月人天 else 0 end as 超期人天 ,case when 转移 is null or 转移<=1 then 当月人天 else 0 end as 人天 ,转移 from {XMFP} Inner JOIN {人员信息表} ON {人员信息表}.[姓名] = {XMFP}.[成员] Inner JOIN {XMZB} ON {xmZB}.[BH] = {XMFP}.[BH] Where 成员='AA' and 任务开始 >= '2020-07-01' and 任务开始 <= '2020-07-31' and 代号 <> '练习')CQ group by 姓名 " '----当月人天,加入超期算
Tables("财务工具_Table1").Fill( dyrt ,"数据源名称",True)
最后的结果

此主题相关图片如下:1.jpg
