Avatar of JDCam
JDCam
 asked on

T-SQL Convert multiple rows to comma separated String

The below query returns 17 unique reference numbers from 400+ rows

select 
Distinct(Ref_Num) 
from DAY_943 where Unique_Ref = '00138AMCR2018-04-21'

Open in new window

I need to output this as a single comma separated string.
By googling I see methods using CTE and XML Path, but not having much luck
Can anyone give me a hand with this Please.

I am using Mangement Studio 2014
* T-SQLSQL

Avatar of undefined
Last Comment
JDCam

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
JDCam

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy