Column to comma delimited column

时间:2017-08-30 20:03:48

标签: sql-server

--Editing this as my question was marked as a duplicate. I'm having an issue implementing STUFF and the "trick" FOR XML PATH when my query contains a join.

I have a single column that I have been trying to convert to a single column and single row. The data structure returned from the query below is:

START

I'd like it to be comma delimited like so: col1 1,2,3

The query I have is as follows:

END

I tried to incorporate STUFF and a FOR XML PATH in this query but keep failing to do so. Can anyone point me in the right direction. I've done this for multiple columns when concatenating rows into a comma delimited column, but for some reason this is driving me crazy.

1 个答案:

答案 0 :(得分:0)

Try this:

(\%)(?:[^!$|\W])
相关问题