Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Grouping GUID's\Concat Strings

Author  Topic 

refreeman4
Starting Member

6 Posts

Posted - 2002-04-11 : 16:55:07
I have a temptable in a procedure that is derived from a query on 2 other tables. For simplicity it is composed of a field that contains the original table GUID and a varchar field. In the temptable there are several records with the same GUID but unique varchar data. I need to somehow group by GUID and produce a single record that contains the GUID field and a varchar field that has ALL of the temptable varchars separated by a comma.
ex
temptable
GUID DATA
x111 this
x111 is
x111 a
x111 test
x222 of
x222 my
x222 patience

groupedtable
GUID DATA
x111 this,is,a,test
x222 of,my,patience


Any ideas? Do I need to somehow loop through the temptable or can it be done in a query?

Thanks for your help.

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-04-11 : 20:50:56
Do a search in the forum and articles for CSV.

I think this topic has come up plenty of times, and the solution is in here somewhere.

Got SQL?
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-11 : 21:30:02
This might help too:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=9978

Go to Top of Page

refreeman4
Starting Member

6 Posts

Posted - 2002-04-11 : 23:24:41
Perfect. Thanks guys.

Go to Top of Page
   

- Advertisement -