>Jay,
>
>Your alternate query would work fine and give the correct results, but it would be slower because your subquery is doing an unnecessary join. I am sure that under certain circumstance the complex subquery would be required.
Jim, you're right! Eliminating the join results in the following cleaner query:
SELECT Employee.* ;
FROM Employee ;
WHERE Employee.EmpID IN ;
(SELECT EmpId ;
FROM Training ;
WHERE Program IN ("Orientation", "OSHA") ;
GROUP BY EmpID ;
HAVING COUNT (EmpID) = 2)
Thanks for the discussion.
I'm trying to get a better handle what SQL can do. The continuous refining of these queries allows some patterns to emerge that I haven't seen before.
Jay