Hi,
I'm muddling my way through by far the most complex SQL query i've ever done, which is probably extremely simple for most of you (:
I have three tables, User, Skills and User_Skills. The fields of which should be fairly self explanatory.
I want to choose people who have one or more skills that meet my criteria.
I can select a user with the skill i'm after, but i'm not sure about the syntax for querying multiple skills.
I'd like to just use one query, so I'm trying to use GROUP_CONCAT
Here's my SQL:
SELECT User_id, first_name, last_name, county, GROUP_CONCAT(CAST(Skill_id AS CHAR))
FROM User LEFT JOIN User_Skills ON User.id = User_Skills.User_id
LEFT JOIN Skills ON User_Skills.Skill_id = Skills.id GROUP BY User_id
User_id first_name last_name county GROUP_CONCAT(CAST(Skill_id AS CHAR))
1000 Joe Blow West Yorkshire 8,6,1,9,7,3,5,10
1001 Fred Bloggs COUNTY1 5,8,2,7,9
1003 asdf asdf1 Some County 10,8,2
How do I limit the search to only people who have skill 5 AND 9 ?