Hi,
I have a query which is supposed to count distinct fields but it doesn't work properly. It does not count the unique values of the PayrollNumber. It counts all values. Any ideas why? Thanks.
[code=sql]SELECT qryProjects.Fis calYear AS FiscalYear, qryProjects.MyF ac AS HomeFac, Count(qryProjec ts.PayrollNumbe r) AS CountOfPayrollN umber, Count(qryProjec ts.GrantID) AS CountOfProjects , Count(IIF(qryPr ojects.contract _type="Tenured" ,0)) AS CountOfTenured
FROM [SELECT DISTINCT qryProjects.Fis calYear, qryProjects.MyF ac, qryProjects.Pay rollNumber, qryProjects.Gra ntID, qryProjects.con tract_type FROM qryProjects ORDER BY qryProjects.Fis calYear]. AS [%$##@_Alias]
GROUP BY [qryProjects].[FiscalYear, [qryProjects].[MyFac]
HAVING ((([qryProjects].[FiscalYear])>="2003/2004"))
ORDER BY [qryProjects].[FiscalYear];[/code]
I have a query which is supposed to count distinct fields but it doesn't work properly. It does not count the unique values of the PayrollNumber. It counts all values. Any ideas why? Thanks.
[code=sql]SELECT qryProjects.Fis calYear AS FiscalYear, qryProjects.MyF ac AS HomeFac, Count(qryProjec ts.PayrollNumbe r) AS CountOfPayrollN umber, Count(qryProjec ts.GrantID) AS CountOfProjects , Count(IIF(qryPr ojects.contract _type="Tenured" ,0)) AS CountOfTenured
FROM [SELECT DISTINCT qryProjects.Fis calYear, qryProjects.MyF ac, qryProjects.Pay rollNumber, qryProjects.Gra ntID, qryProjects.con tract_type FROM qryProjects ORDER BY qryProjects.Fis calYear]. AS [%$##@_Alias]
GROUP BY [qryProjects].[FiscalYear, [qryProjects].[MyFac]
HAVING ((([qryProjects].[FiscalYear])>="2003/2004"))
ORDER BY [qryProjects].[FiscalYear];[/code]
Comment