????????2??????????????????

?????????????Id??????ж?tab_1??????????SkillId???????????tab_2??????????SkillId???????????÷?????????????????
?????????????????????????charindex??????
with cte1 as(
select Id?? stuff((select '??'+ CONVERT(varchar??SkillId) from tab_1 t where t.Id=t1.Id  for xml path(''))??1??1??'') as Skills from tab_1 t1
group by Id
)??
cte2 as(
select Id?? stuff((select '??'+ CONVERT(varchar??SkillId) from tab_2 tt where tt.Id=tt1.Id for xml path(''))??1??1??'') as Skills from tab_2 tt1
group by Id
)select * from cte1 join cte2 on CHARINDEX(cte2.Skills??cte1.Skills)=1
????????????????SQL Server??for xml path()????У?stuff()???????????????charindex()?????????????????????
???????????@С?????@С???????????·??
????1.??2????????????????????????????????????
????2.????1??2?????????????SkillId???б????????????1??2???????????ν????????????????????????????????
????3.??2?ó??????????????????????????1???????????????????????2?????????>=????T-SQL???£?
with cte1 as(
select id??SkillId??count(1) over (partition by Id) as count1 from tab_1
)??cte2 as(
select id??SkillId??count(1) over (partition by Id) as count2 from tab_2
)??cte3 as(
select cte1.Id??cte1.Skillid??count1??cte2.Id as Id2??cte2.SkillId as SkillId2??cte2.count2??
COUNT(1) over (partition by cte1.Id??cte2.Id) as count3
from cte1  full join cte2
on cte1.SkillId=cte2.SkillId
)select Id??SkillId??Id2??SkillId2 from cte3
where count1=count2 and count3=count2
???????????????????????????????е??ɡ???????????????????????????????м???