I have a simple employee training database. The two tables are linked using NI number. The LU_Course is just a lookup for the ethnicity code stored in the employee table.
The query I am running below works but takes 50 seconds to complete. If I run it in two stages the results appear instantaneously.
I would like to know if it is possible to run a query using an ADO recordset then use that to run a second query.
Thanks,
MDAV
IS
SELECT IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription]) AS Ethnic_Description, LU_Ethnicity.EthnicityCode, Count(IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription])) AS Ethnic_Count
FROM LU_Ethnicity RIGHT JOIN T_Employee ON LU_Ethnicity.EthnicityCode = T_Employee.Ethnicity
WHERE (((T_Employee.NINumber) In (SELECT DISTINCT T_Employee.NINumber FROM T_Training INNER JOIN T_Employee ON T_Training.NINumber = T_Employee.NINumber WHERE (((T_Training.DateTaken) Is Not Null Or (T_Training.DateTaken) Between #1/1/1980# And #1/1/2999#)))))
GROUP BY IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription]), LU_Ethnicity.EthnicityCode
ORDER BY LU_Ethnicity.EthnicityCode;
The query I am running below works but takes 50 seconds to complete. If I run it in two stages the results appear instantaneously.
I would like to know if it is possible to run a query using an ADO recordset then use that to run a second query.
Thanks,
MDAV
IS
SELECT IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription]) AS Ethnic_Description, LU_Ethnicity.EthnicityCode, Count(IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription])) AS Ethnic_Count
FROM LU_Ethnicity RIGHT JOIN T_Employee ON LU_Ethnicity.EthnicityCode = T_Employee.Ethnicity
WHERE (((T_Employee.NINumber) In (SELECT DISTINCT T_Employee.NINumber FROM T_Training INNER JOIN T_Employee ON T_Training.NINumber = T_Employee.NINumber WHERE (((T_Training.DateTaken) Is Not Null Or (T_Training.DateTaken) Between #1/1/1980# And #1/1/2999#)))))
GROUP BY IIf(IsNull([EthnicityDescription]),'Not Recorded',[EthnicityDescription]), LU_Ethnicity.EthnicityCode
ORDER BY LU_Ethnicity.EthnicityCode;