--创建处理函数
create function f_str(@id int)
returns varchar(8000)
as
begin
declare @r varchar(8000)
set @r=''
select @r=@r+','+摘要 from b where id=@id
return(substring(@r,2,8000))
end
go--调用实现查询
select id,姓名,摘要=dbo.f_str(id)
from a 
group by id,姓名