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 |
|
Ubaid
Starting Member
1 Post |
Posted - 2011-12-08 : 06:41:15
|
| hi,i have a serious problem any body can help me! std_id------------std_name 1 --------------- A 1 --------------- B 1 --------------- C 2 --------------- D 2 ---------------ENow i want to print like this. std_id ----------- std_name 1 ------------A,B,C 2 -------------D,EAny body can help me plz and what's will be the query for this |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-08 : 06:53:51
|
| [code]SELECT std_id,STUFF((SELECT ','+ STD_NAME FROM table where std_id=T.std_id ORDER BY std_name ASC FOR XML PATH('')),1,1,'') AS std_nameFROM (SELECT DISTINCT std_id FROM table)t[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|