SqlServer 将多条数据的某列按“,”号拼接 查询出来

SELECT (select stuff((SELECT ','+ Phone from dbo.ReservationDetails WHERE ReservationDetailId IN (
                SELECT  Item
                FROM    dbo.fnSplit(@ReservationDetailId, ',') )  for xml path('')),1,1,'')) AS Mobiles

 

posted @ 2018-07-23 09:45  蜗牛的礼物  阅读(881)  评论(0编辑  收藏  举报