Q&A for developers and researchers interested in open data
WITH TopPosts AS ( SELECT TOP(300) Id, ViewCount, Title, Body, Score, CreationDate, Tags, AnswerCount, CommentCount, FavoriteCount FROM Posts WHERE PostTypeId = 1 ORDER BY ViewCount DESC, Score DESC ) SELECT p.Id AS PostId, p.Title, p.Body, p.ViewCount, p.Score, p.CreationDate, p.Tags, p.AnswerCount, p.CommentCount, p.FavoriteCount, c.Id AS CommentId, c.Text AS CommentText, c.CreationDate AS CommentCreationDate, c.Score AS CommentScore FROM TopPosts p LEFT JOIN Comments c ON p.Id = c.PostId ORDER BY p.ViewCount DESC, p.Score DESC, c.CreationDate;