我有一份报告列出了在调查中回答特定问题的员工人数,并列出了总人口。我试图获得答案占总人口的百分比,但我无法让代码正常工作。到目前为止,我的代码是:
SELECT
Mgmt_Lvl.MGMT_LVL,
Count(O896IA_VEMPPRSA.SYS_EMP_ID_NR) AS Total,
Sum(IIf(emp_rlc_ir="Y",1,0)) AS Relocate,
Sum(IIf(emp_int_asn_ir="Y",1,0)) AS International_Assignment,
Sum(IIf(emp_tvl_ir="y",1,0)) AS Travel,
Sum(IIf(emp_spc_asn_ir="y",1,0)) AS Special_Assignment
FROM (O867IA_VPJOBCO
INNER JOIN Mgmt_Lvl ON O867IA_VPJOBCO.JOB_GRP_CD = Mgmt_Lvl.JOB_GRP_CD)
INNER JOIN (O896IA_VEMPPRSA INNER JOIN O867IA_VCAREER
ON O896IA_VEMPPRSA.SYS_EMP_ID_NR = O867IA_VCAREER.SYS_EMP_ID_NR)
ON O867IA_VPJOBCO.JOB_CLS_CD = O896IA_VEMPPRSA.JOB_CLS_CD
WHERE (((O896IA_VEMPPRSA.EMP_EMT_STS_CD)<>"T"))
GROUP BY Mgmt_Lvl.MGMT_LVL;
SUM(IIF(... 是计数,TOTAL 是总人口。我需要得到 SUM(IIF( / TOTAL 才能得到百分比。