Q&A for people studying math at any level and professionals in related fields
SELECT c.PostId AS AnswerId, STUFF(( SELECT ' | ' + c2.Text FROM Comments c2 WHERE c2.PostId = c.PostId ORDER BY c2.CreationDate FOR XML PATH(''), TYPE ).value('.', 'NVARCHAR(MAX)'), 1, 3, '') AS AllComments FROM Comments c JOIN Posts p ON c.PostId = p.Id WHERE p.Id IN (12453584, 2988271) AND p.PostTypeId = 2 -- PostTypeId = 2 indicates answers GROUP BY c.PostId ORDER BY c.PostId;