SELECT
sampleid,
testitem = STUFF(
(
SELECT
',' + testitem
FROM
t_order_testitem AS t
WHERE
t.sampleid = t_order_testitem.sampleid FOR xml path ('')
),
1,
1,
''
)
FROM
t_order_testitem
GROUP BY
sampleid