select distinct stuff((select ','+QuestionCategoryName from QuestionCategory t where
QuestionCategoryID in (select QuestionCategoryID from QuestionCategoryRelation where QuestionID=p.QuestionID)
for xml path('')), 1, 1, '')
from QuestionCategory
QuestionCategoryID in (select QuestionCategoryID from QuestionCategoryRelation where QuestionID=p.QuestionID)
for xml path('')), 1, 1, '')
from QuestionCategory