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.
Author |
Topic |
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2012-09-05 : 11:37:53
|
i have table like this :1,a@b.com1,adf@b.com1,adf@bdfgdfg.com2,dfg@sdf.comand i want to get :1,"a@b.com,adf@b.com,adf@bdfgdfg.com"2,dfg@sdf.comhow do i do this?10X:) |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-05 : 20:51:43
|
[code]SELECT id,STUFF((SELECT ',' + email FROM table WHERE id = t.id FOR XML PATH('')),1,1,'')FROM (SELECT DISTINCT id FROM Table)t[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|