Q&A for users of TeX, LaTeX, ConTeXt, and related typesetting systems
SELECT TOP (50000) q.Id,u.DisplayName AS "Asker", u.Id AS AskerLink, au.DisplayName AS "Answerer", au.Id AS AnswererLink, null as Link, q.Body as QuestionBody, q.Title, a.Body AS HighestScoringAnswer from posts a inner join (select r.Id, r.Title,r.Body,r.OwnerUserId, max(p.Score) Score from posts p inner join posts r on p.ParentId = r.Id where p.PostTypeId = 2 and p.Score >= 0 group by r.Id, r.Body,r.Title,r.OwnerUserId) q on a.ParentId = q.Id and a.Score = q.Score join Users u ON q.OwnerUserId = u.Id JOIN Users au ON a.OwnerUserId = au.Id WHERE q.id >##qid## ORDER BY q.id