|
楼主 |
发表于 2016-10-26 16:57
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请问,我这样的写法,为什么不能同时得到在职人数和离职人数,是因为你说的统计期间不统一导致的嘛?
请问我错在什么地方?盼复
select "10/02" as 统计期间,二级部门,三级部门,四级部门,count(离职时间) as 离职人数,count(车间上报入职日期) as 在职人数 from [花名册$] where 车间上报入职日期 <=#2016/10/02# or 离职时间 =#2016/10/02# group by 二级部门,三级部门,四级部门 order by count(离职时间) desc
union all
select "10/03" as 统计期间,二级部门,三级部门,四级部门,count(离职时间) as 离职人数,count(车间上报入职日期) as 在职人数 from [花名册$] where 车间上报入职日期 <=#2016/10/03# or 离职时间 =#2016/10/03# group by 二级部门,三级部门,四级部门
union all
select "10/04" as 统计期间,二级部门,三级部门,四级部门,count(离职时间) as 离职人数,count(车间上报入职日期) as 在职人数 from [花名册$] where 车间上报入职日期 <=#2016/10/04# or 离职时间 =#2016/10/04# group by 二级部门,三级部门,四级部门 |
|