create table t(a nvarchar(10),b nvarchar(10),c nvarchar(10))
insert into t select '足球',   '耐克' ,    '5号球'
union all select '足球',   '耐克' ,    '3号球'
union all select '足球',   '耐克' ,    '4号球'
union all select '足球',   '火车头' ,    '3号球'
union all select '足球',   '火车头' ,    '4号球'
union all select '足球',   '火车头' ,    '4号球'
union all select '足球',   '阿迪达斯' ,    '3号球'
union all select '足球',   '阿迪达斯' ,    '3号球'
union all select '足球',   '阿迪达斯' ,    '5号球'
go
create function f_test(@b nvarchar(10))
returns nvarchar(1000)
as
  begin
  declare @s nvarchar(1000)
  set @s=''
  select @s=@s+' '+c from (select distinct * from t)t where b=@b
  return(@s)
  end
goselect distinct a,b,dbo.f_test(b) as c from t drop function f_test
drop table t