我想確定2007-2013年間培訓課程的出席人數。我需要它拉在這段時間內,他們在員工工作組:MAX日期小於另一日期
SELECT O867IA_VJOBHST.JOB_CLS_CD, O867IA_VJOBHST.DIS_NR,
Sum(IIf(emp_tng_stt_dt Between #1/1/2007# And #12/31/2011#,1,0)) AS [2007-2011],
Sum(IIf(emp_tng_stt_dt Between #1/1/2011# And #12/31/2011#,1,0)) AS 2011,
Sum(IIf(emp_tng_stt_dt Between #1/1/2012# And #12/31/2012#,1,0)) AS 2012,
Sum(IIf(emp_tng_stt_dt Between #1/1/2013# And #9/23/2013#,1,0)) AS 2013, O867IA_VJOBHST.REC_EFF_STT_DT, O867IA_VTRAING.EMP_TNG_STT_DT
FROM (O867IA_VJOBHST INNER JOIN O867IA_VTRAING ON O867IA_VJOBHST.SYS_EMP_ID_NR = O867IA_VTRAING.SYS_EMP_ID_NR) INNER JOIN O867IA_VPJOBCO ON O867IA_VJOBHST.JOB_CLS_CD = O867IA_VPJOBCO.JOB_CLS_CD
WHERE (((O867IA_VTRAING.REG_NR)="03") AND ((O867IA_VTRAING.TNG_SYS_NR)="0918") AND ((O867IA_VPJOBCO.JOB_GRP_CD)="61"))
GROUP BY O867IA_VJOBHST.JOB_CLS_CD, O867IA_VJOBHST.DIS_NR, O867IA_VJOBHST.REC_EFF_STT_DT, O867IA_VTRAING.EMP_TNG_STT_DT;
的REC_EFF_STT_DT場是他們記錄了他們的工作的日期,所以我試圖讓這成爲MAX日期,而且需要小於培訓課程舉辦時的EMP_TNG_STT_DT。我嘗試將它設置爲(((O867IA_VJOBHST.REC_EFF_STT_DT)< [O867IA_VTRAING]。[EMP_TNG_STT_DT]));但是當我將MAX添加到REC EFF STT DT時,它會一直給我一個錯誤「您試圖執行不包含指定表達式的查詢」。我找不到任何解決方案並需要幫助。
我確實已經嘗試過了,但我仍然收到錯誤消息。 – user2119980