Is there any other solution to make tables concatenation without FOR XML PATH
?
I have this code which I want to somehow improve, because with this code I got errors in other views.
I started to think about using concat
or something similar. String_agg
not an option here.
[table] = SUBSTRING((SELECT ',' + [PatGroup].[PG_K] AS [text()]
FROM D1_EPSDPATGROUPS [Episode]
INNER JOIN C1S_PATIENTGROUP [PatGroup]
ON [Episode].[PG_ID] = [PatGroup].[PG_ID]
WHERE [Episode].[EPSD_ID] = D1_EPISODE.EPSD_ID
FOR XML PATH ('')), 2, 1000)