Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create comma separated list

Status
Not open for further replies.

trpnbillie

Programmer
Oct 8, 2002
28
0
0
US
Hi. I have a table Employee with ID, Name and Country column

1 John Doe USA
1 John Doe CAN
1 John Doe GBR
2 Sally Jo CAN
2 Sally Jo MEX

I want to produce this result set:

1 John Doe USA, CAN, GBR
2 Sally Jo CAN, MEX

Is there an efficient way to do this without a cursor? (or is cursor my only option?)

thanks for your help!!!
 
User-defined function (UDF).

Search this forum, this was done at least 1242342423 times [smile].

------
[small]select stuff(stuff(replicate('<P> <B> ', 14), 109, 0, '<.'), 112, 0, '/')[/small]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top