troubleshooting Question

SQL Query How do I select multiple records where a person can have many skills.

Avatar of rhill52
rhill52 asked on
Visual Basic.NETMicrosoft SQL Server 2005Microsoft SQL Server 2008
23 Comments1 Solution402 ViewsLast Modified:
Hi how can I create a query that matches Skills in my table to a person id in another so a person can have many skills, but I want to be able to select a few different skills then show me a list of people who have the skills selected.

this does not work just shows no data, if just one parm is selected I get the desired result.
SELECT   SKILL.SKILL,
         PEOPLE.FULLNAME
FROM     SKILL
RIGHT OUTER JOIN PEOPLE ON
         PEOPLE.PEOPLE_ID =
         SKILL.PEOPLE_ID
WHERE     ( SKILL.SKILL = @_SKILL )
AND       ( SKILL.SKILL = @_SKILL2 )  

or another example that returns no rows, if just one skill is entered the results are as expected.

SELECT   SKILL.SKILL,
         PEOPLE.FULLNAME
FROM     SKILL
RIGHT OUTER JOIN PEOPLE ON
         PEOPLE.PEOPLE_ID =
         SKILL.PEOPLE_ID where skill.skill = 'rigger' and skill.skill = 'plater'
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 23 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 23 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros