select * from
(select userid from dbo.Sys_Users_Record group by userid) a
outer apply
(select substring(replace(replace(
(select total from Sys_Users_Record c where userid=a.userid for xml auto)
,'<c total="',','),'"/>',''),2,8000) recordid
) b
(select userid from dbo.Sys_Users_Record group by userid) a
outer apply
(select substring(replace(replace(
(select total from Sys_Users_Record c where userid=a.userid for xml auto)
,'<c total="',','),'"/>',''),2,8000) recordid
) b