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, '')
吾乃代码搬运工,侵联删
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, '')