select SizeID,Matid,SizeCaption from mmfsize(nolock) where matid='000309' order by SizeID
select (select SizeCaption+',' from mmfsize(nolock) b where a.Matid=b.Matid order by b.SizeID for xml path('')) as SizeCaption
from MMFSize(nolock) a where a.Matid='000309' group by Matid