SELECT Sum(IIf(DateDiff("m",员工资料.入厂时间,员工资料.离职日期)<=3,1,0)) AS 三个月内, Sum(IIf(DateDiff("m",员工资料.入厂时间,员工资料.离职日期)<=6,1,0)) AS 六个月内, Sum(IIf(DateDiff("m",员工资料.入厂时间,员工资料.离职日期)<=12,1,0)) AS 一年内, Sum(IIf(DateDiff("m",员工资料.入厂时间,员工资料.离职日期)<=36,1,0)) AS 3年内, Sum(IIf(DateDiff("m",员工资料.入厂时间,员工资料.离职日期)<=60,1,0)) AS 5年内
FROM 员工资料;