vignesh.ms (6/16/2013)
Works fine but im a newbie to SQL ...Please explain how it works....
The explanation is present in the link I had provided earlier. I will add it once again for your reference.
http://www.sqlservercentral.com/articles/comma+separated+list/71700/
There is another article which contains a few more methods to achieve the same result
You can check those as well and use whichever you prefer
https://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/
Edit:Added one more link to an article
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/