为了简短起见,这是我的 SQL 代码:
SELECT
EmailAddress,
FormsSubmitted = STUFF(
(
SELECT ',' + SourceSubType
FROM UK_AGT_AgentForms_TEST_DE a
WHERE a.EmailAddress = b.EmailAddress
FOR XML PATH('')
), 1, 1, ''),
DEDate
FROM UK_AGT_AgentForms_TEST_DE b
GROUP BY b.EmailAddress, b.DEDate
有没有办法防止重复值出现在FormsSubmitted
上面查询中的列中?还是我需要做一些“后处理”来删除重复项?