>>>>>When I run this
>>>>>
>>>>>
>>>>>SELECT *
>>>>> FROM (SELECT DISTINCT s.GroupId, e.EmployeeID, IIf(e.Certified Is Null,0,1) AS cert_complete
>>>>> FROM ((Stores AS s
>>>>> INNER JOIN EmployeeStores AS es ON s.StoreId=es.StoreId)
>>>>> INNER JOIN Employees AS e ON es.EmployeeId=e.EmployeeID)
>>>>> INNER JOIN Titles AS t ON e.TitleId=t.TitleId WHERE t.IsManager=True AND e.IsActive=True) AS d
>>>>>
>>>>>
>>>>>It doesn't appear to be returning active employees. I'm getting back EmployeeId as part of the result set, and no inactive id's appear in the set.
>>>>
>>>>Ok, so it does work correctly.
>>>
>>>Yes it does, except when I run the whole thing I still get Active employees.
>>
>>You're supposed to only get Active Employees with the IsActive = 'true' condition.
>
>Sorry, I meant when I run the whole thing I get
Inactive employees
I don't see how is it possible. If they are filtered in derived tables, they can not re-appear in the final select.
If it's not broken, fix it until it is.
My Blog