I'm trying to have the 'test' column in the same row. I'm using Stuff()
however, it seems that the 'test' column is going through all the qID
What am I missing?
SELECT DISTINCT qID,
STUFF((
select ',' + B.text
from tbl B
where B.qID=qID
order by B.text
for xml path('')
),1,1,'') as test
FROM tbl
WHERE qID in (2258060,2296222)
GROUP BY qID