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
 General SQL Server Forums
 New to SQL Server Programming
 Concaternate string from same column

Author  Topic 

maevr
Posting Yak Master

169 Posts

Posted - 2008-01-21 : 08:04:21
I want to concaternate all rows that has the same ID and update another table.

Table1:
ID: COL1
1 txt1
1 txt2
1 txt3
2 txt7
3 txt5
3 txt6

OUTPUT:
ID: COL1:
1 txt1, txt2, txt3
2 txt7
3 txt5, txt6

How do I manage this, have tried self join but with no luck.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-01-21 : 08:13:59
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254
http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/rowset-string-concatenation-which-method-is-best.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

maevr
Posting Yak Master

169 Posts

Posted - 2008-01-21 : 08:39:03
Thanks for the fast reply!
How can I do an update on another table based on the results.
Go to Top of Page
   

- Advertisement -