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 |  
                                    | nordPosting Yak  Master
 
 
                                        126 Posts | 
                                            
                                            |  Posted - 2013-12-12 : 12:10:41 
 |  
                                            | Hi all,I have table size_cd       size_descr    size num   1               01           2   1               02           3   1               02           15   2                03          1   2                04           7   2                05           11I would like reseive    size_cd     1              2,3,15     2              1,7,11Thanks |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2013-12-12 : 13:22:18 
 |  
                                          | [code]SELECT size_cd,STUFF ((SELECT ',' + CAST([size num] AS varchar(5)) FROM table WHERE size_cd = t.size_cd ORDER BY [size num] FOR XML PATH('')),1,1,'')FROM (SELECT DISTINCT size_cd FROM table)t[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |  
                                          |  |  |  
                                |  |  |  |