Possible Duplicate:
SQL group_concat function in SQL Server
I am looking to create a query but somehow I am unable to do so. Can anyone please help me out here?
The original data
ID    ReportId     Email
1     1            a@a.com
2     2            b@b.com
3     1            c@c.com
4     3            d@d.com
5     3            e@e.com
I want to group by ReportId, but all the email should be comma separated. So the result should be:
ReportId     Email
1            a@a.com, c@c.com
2            b@b.com
3            d@d.com, e@e.com
What is the best way to do this?
I am trying the group by clause but if there is any other thing then i am open to implement that also. I really appreciate your time and help on this. Thank you.
 
     
     
     
    