This is a typical relational division problem.
Take a look at this article
select E.* from Employee E inner join EmployeeSkills ES ON E.EmpID = ES.EmpID INNER JOIN Skills S ON ES.SkillID = S.SkillID
INNER JOIN @ListOfSkills LS ON S.SkillName = LS.SkillName
GROUP BY E.EmpID, E.Name
HAVING COUNT(S.SkillID) = (select count(*) from @ListOfSkills)
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles
No comments:
Post a Comment