Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-21 : 11:26:31
|
Muni writes "I have situation as follows. We have three tables.1. Person - Id, Name and address2. Skills - ID, Name3. PersonSkills - personID, SkillID. One prson may have many skills. Each skill may be provided by many persons. Each person may have different set of skills.Now the question is, I want a query, where by I would like to get the list of people who posseses a given list of skills (list may have varied numbers). The person should have all the skills as mentioned in the list.ThanksMuni" |
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-06-21 : 11:33:56
|
This might work:Select z.*From Person as ZInner Join (Select PersonIdFrom PersonSkills as AInner Join (Select id From skills Where ','+id+',' like ','+@SkillListById+',') as BOn A.SkillId = B.IdGroup By PersonIdHaving count(*) = (Select count(*) From skills Where ','+id+',' like ','+@SkillListById+',')) as YOn Z.id = y.PersonIdCorey |
|
|
|
|
|