IamBlossom Posted February 4, 2020 Report Share Posted February 4, 2020 I have this formula that pulls up the record associated by ID, then display in a single line. SELECT CAST(Name AS nvarchar) + N', ' FROM PE_USER_TABLE PE_ID = target.[@field:PE_ID] for xml path(N'') The result is Marco, Mary, Marie, How can I remove the last comma "," ? Thanks! Quote Link to comment Share on other sites More sharing options...
0 cheonsa Posted February 4, 2020 Report Share Posted February 4, 2020 Hi @IamBlossom, What you can do about this is to add the "," before the result. You may try this one: SELECT ABC = STUFF((SELECT ', ' + CAST(Name AS nvarchar) FROM PE_USER_TABLE WHERE PE_ID = target.[@field:PE_ID] FOR XML PATH ('')), 1, 1, '') I am also using the same formula and I am getting my desired output. Cheers! Quote Link to comment Share on other sites More sharing options...
Question
IamBlossom
I have this formula that pulls up the record associated by ID, then display in a single line.
SELECT CAST(Name AS nvarchar) + N', ' FROM PE_USER_TABLE PE_ID = target.[@field:PE_ID] for xml path(N'')
The result is Marco, Mary, Marie,
How can I remove the last comma "," ?
Thanks!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.