这个你试下看行不了
declare @b varchar(2000)
declare @temp table(no int identity(1,1),a varchar(10),b varchar(1000))
declare @a varchar(10)
declare cr cursor for
select distinct a from abc
open cr
fetch next from cr
into @a
while @@fetch_status=0
begin
set @b=''
select @b=@b+','+b from abc where a=@a
insert into @temp(a,b)
select @a,stuff(@b,1,1,'')
fetch next from cr
into @a
end
close cr
deallocate cr
select * from @temp