I have this query here...
SELECT DISTINCT Coalesce(NULLIF(FullDataTable.workgrp,''),'UNKNOWN') as value, Coalesce(NULLIF(AvaDepartmentLookup.departmenttitle,''),'UNKNOWN') as title
FROM FullDataTable LEFT OUTER JOIN AvaDepartmentLookup ON FullDataTable.workgrp = AvaDepartmentLookup.departmentvalue
Where (FullDataTable.workgrp not in (select AvaDepartment_Exclusion.departmentvalue from AvaDepartment_Exclusion))
order by title
If I take the where clause out, the query runs instantly. The moment I place the where clause back in, it runs forever???
The AVADepartment_Exclusion.department value table is just a simple lookup table with and 'id' column that auto populated and a 'departmentvalue' column which holds simple string values that would match workgrp?
Am I'm overlooking something.
Also, workgrp is indexed.
Thanks for any insite