标签:sele ati operator sel flow select 分组 SQ highlight
/* 分组之后拼接字符串 */ ;with t as( SELECT WorkflowId,Remark FROM dbo.OperatorAutomationProcess GROUP BY WorkflowId,Remark ) , H AS( SELECT WorkflowId, -- 分组的主键 STUFF( ( SELECT ‘_‘+ Remark -- 要拼接的列 FROM t a WHERE b.WorkflowId = a.WorkflowId FOR XML PATH(‘‘) ),1 ,1, ‘‘) Remark FROM t b GROUP BY WorkflowId ) SELECT * FROM H
要分组的数据:
按照分组 拼接后的数据:
标签:sele ati operator sel flow select 分组 SQ highlight
原文地址:https://www.cnblogs.com/hnzheng/p/9151877.html