After so few Joins my View is like this
ID      Code
1       US
1       UK
1       GR
2       US
2       IN
3       US  
3       AF
3       RU
3       SA
Required Result :
ID  Code
1   US,UK,GR
2   US,IN
3   US,AF,RU,SA
I tried using FOR XML PATH.
But as the number of records are high in my table it is causing performance issue it is taking more than 20 minutes to execute
 
     
    