Here is one way:
declare @t table (i int, c char(1))
insert into @t (i,c) values (1,'a'),(1,'b'),(1,'c'),(2,'a'),(2,'b')
select * from @t;
With MyCTE as (
select distinct i, (select t2.c + ',' from @t as t2 where t1.i = t2.i for xml path('')) as Letters
from @t t1)
select i, left(Letters, len(Letters) - 1)
from MyCTE
go
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/