create function getstr(@a varchar(10),@b int)
returns varchar(2000)
as 
begin
declare @str varchar(2000)
set @str=''
select @str=@str+','+rtrim(itm) from a where mdl=@a and position=@b and seq<>1
select @str=right(@str,len(@str)-1) where @str<>''
return @str
end
go--调用:
select itm,mdl,position,seq,dbo.getstr(mdl,position) 辅料 from 表 where seq=1