DECLARE @DataSeries VARCHAR(MAX);
SELECT TOP 10
@DataSeries = ISNULL(@DataSeries + ' | ', '') + CONVERT(VARCHAR(100) , [Name])
FROM Production.Product;
SELECT
[ProductCategoryID],
[Name],
STUFF
(
(
SELECT TOP 5 ' | ' + [Name]
FROM Production.Product
WHERE Production.Product.ProductSubcategoryID = Production.ProductCategory.ProductCategoryID
FOR XML PATH ('')
), 1, 2, ''
) AS [TopProducts]
FROM Production.ProductCategory