The temp table has been used to get a code block for demonstration purposes.
Assuming you're last statement will end with a semicolon, you could simply use
WITH CTE AS
(
SELECT *
FROM
YourTableNameGoesHere
CROSS APPLY
(SELECT * FROM dbo.DelimitedSplit8K(val, ',')) x
)
SELECT UserName = CTE1.Item, SaleNumber = REPLACE(CHAR(39) + CTE2.Item + CHAR(39), CHAR(39)+CHAR(39), CHAR(39))
FROM CTE CTE1
INNER JOIN (SELECT Item,id FROM CTE WHERE ItemNumber > 1 ) CTE2 ON CTE1.id=CTE2.id
WHERE CTE1.ItemNumber = 1; and replace YourTableNameGoesHere with your actual table name.
If there are any errors, they'd be most like due to different column names. If not, post the full error message andwe'll see if we can assist you any further.