I am using the solution found here but I need to ignore the ordering in FOR XML PATH
.
The sample data is:
ID DisplayName
1 Editor
1 Reviewer
7 EIC
7 Editor
7 Reviewer
7 Editor
19 EIC
19 Editor
19 Reviewer
And the solution's result is:
ID DisplayName
1 Editor, Reviewer
7 Editor, EIC, Reviewer
19 Editor, EIC, Reviewer
I need to find a way to stop FOR XML PATH
from arranging the strings and return results in the exact order like:
ID DisplayName
1 Editor, Reviewer
7 EIC, Editor, Reviewer, Editor
19 EIC, Editor, Reviewer
UPDATE:
My table looks something like:
ID DisplayName Sequence
1 Editor 1
1 Reviewer 2
7 EIC 1
7 Editor 2
7 Reviewer 3
7 Editor 4
19 EIC 1
19 Editor 2
19 Reviewer 3
So I want it to combine strings based on the sequence of each ID.