sqlserver多个值拼接并去重

      STUFF(
    (SELECT DISTINCT ', ' + FK_EXPERT_PHONES
     FROM T_RISK_TASK_SERVICE
       WHERE FK_RISK_CONTROL_ID=__T1.ID AND FK_EXPERT_IDS != ''
     FOR XML PATH(''), TYPE
    ).value('.', 'NVARCHAR(MAX)'), 1, 2, '')

 

posted on 2024-06-20 08:52  五官一体即忢  阅读(4)  评论(0编辑  收藏  举报

导航