select productid, (select cast(vendorid as varchar(10))+';' as [text()] from Purchasing.ProductVendor as o where o.productid = c.productid order by vendorid for xml path('')) as orders from Purchasing.ProductVendor as c group by productid ;
select productid, (select cast(vendorid as varchar(10))+';' as [text()] from Purchasing.ProductVendor as o where o.productid = c.productid order by vendorid for xml path('')) as orders from Purchasing.ProductVendor as c group by productid ;