SELECT A.CID,B.TrueName
into #UserName
FROM RH_CommuUserRole A WITH(NOLOCK)
Left join RH_User B WITH(NOLOCK) on A.UserID=B.id AND A.UType=1
WHERE B.UserState = 1
select CID,TrueName=STUFF((select ','+ltrim(TrueName) from #UserName where CID=t.CID for XML path('')),1,1,'')
INTO #NameResult
from #UserName t
group by CID