Here's one way:use tempdbgocreate table Customer ( CustomerID int IDENTITY (1,1), CustomerName nvarchar(50) )gocreate table Product ( ProductID int IDENTITY (1,1), ProductName nvarchar(50) )gocreate table CustomerProduct ( CustomerID int, ProductID int )goset nocount oninsert customer (customerName)select 'John Smith' union allselect 'Jane Doe'insert product (productName)select 'prod 1' union allselect 'prod 2' union allselect 'prod 3'insert CustomerProductselect 1,1 union allselect 1,2 union allselect 2,1 union allselect 2,2 union allselect 2,3select c.customerName, oa.ProductXMLfrom Customer ccross apply ( select productid from CustomerProduct where customerid = c.customerid for xml path('row') ) oa (productXML)godrop table customerProductdrop table productdrop table customeroutput:customerName productXML-------------------------------------------------- -----------------------------------------------------------------------------------------------------------John Smith <row><productid>1</productid></row><row><productid>2</productid></row>Jane Doe <row><productid>1</productid></row><row><productid>2</productid></row><row><productid>3</productid></row>Be One with the OptimizerTG