I have two tables:
Employers:
emp_id:     emp_name:
1           Smith
2           John
3           Terry
4           Sue
and antoher one,
Skills:
emp_id:  skill:
1        10
1        12
1        14
2        5
2        15
I want to get a query which returns this:
emp_id:  skill:
1        10,12,14
2        5,15
So far I'm able to get skill values as string by using:
SELECT STUFF((SELECT DISTINCT  ', ' + skill) AS [text()]
FROM employers inner join skills where emp_id=1
FOR XML PATH ('')),1,1,'')
But this does not help, because I need to join the values in my project to other columns and I need also that emp_id.
Any hints?
 
     
     
    