sql for xml path

 

 

 

 

SELECT  r.Id, r.Name, (SELECT STUFF((SELECT ',' + v.SubName FROM Records v WHERE v.Id = r.Id FOR XML PATH('')), 1, 1, '')) AS SubNames
FROM    Records r ;

 

 

posted on 2019-10-17 22:11  Aidou_dream  阅读(93)  评论(0编辑  收藏  举报

导航