I have a SQL query that is returning a table like the following:
id  emp_name    total_explabor_grade    title       name
518 Name,One    3   PE4 Software Engineer   Java
492 Name,Two    4   PE1 Software Engineer   Java
502 Name,Three  1   SPE5    Principal       Javascript
410 Name,Four   3   ENG3    Software Engineer   Java
147 Name,Five   5   SPE5    Director        Java
147 Name,Five   2   SPE5    Director        Javascript
156 Name,Six    10  PE2 Senior          Java
156 Name,Six    8   PE2 Senior          Javascript
This was based off a query for people that have the skills of Java OR Javascript. As you can see, employee 147 and 156 had a hit for both Java and Javascript.
If I am storing this current query into a temporary table, say #TempTable
What query can I run on #TempTable to give me a result like this:
id  emp_name    total_explabor_grade    title       name
518 Name,One    3   PE4 Software Engineer   Java
492 Name,Two    4   PE1 Software Engineer   Java
502 Name,Three  1   SPE5    Principal       Javascript
410 Name,Four   3   ENG3    Software Engineer   Java
147 Name,Five   5,2 SPE5    Director        Java,Javascript
156 Name,Six    10,8    PE2 Senior          Java,JavaScript
I have tried to do a Join of #TempTable with itself in various forms, but I havent been able to get it to give me a table like what I just posted. This is the code I have written so far...
select t1.id, t1.emp_name, CONVERT(nvarchar(3),t1.total_exp)+','+CONVERT(nvarchar(3),t2.total_exp), t1.labor_grade, t1.title, t1.name+','+t2.name AS hits
from #TempTable t1 JOIN #TempTable t2
 ON t1.id=t2.id
Does anyone know if it is possible to do a join like I am looking to do? My latest line of thinking is it will take more than one select, but I havent quite figured it out
 
     
     
    