一张表关联多张表,多张表数据“,”隔开赋值

SELECT MeetingSn ,
  STUFF(( SELECT ',' + ProductName
    FROM MeetingProduct t
    WHERE MeetingSn = msp.MeetingSn
  FOR
    XML PATH('')
  ), 1, 1, '') AS ProductName
FROM dbo.MeetingProduct msp
WHERE IsDeleted = 0
GROUP BY MeetingSn

posted @ 2022-09-27 15:05  小易儿  阅读(16)  评论(0编辑  收藏  举报