Q&A for amateur radio enthusiasts
set statistics io on; SELECT TOP 50 post.Id AS [Post Link], post.Score, postType.Name, post.CreationDate FROM Posts post INNER JOIN PostTypes postType ON postType.Id = post.PostTypeId WHERE post.Score < 0 AND post.ClosedDate IS NULL AND post.PostTypeId IN (1, 2) AND DATEDIFF(m, post.CreationDate, GETDATE()) <= 18 AND EXISTS ( SELECT comment.PostId FROM Comments comment WHERE comment.PostId = post.Id GROUP BY comment.PostId HAVING COUNT(*) > 0 ) ORDER BY post.Score ASC