find questions older than 60 days which have no answers of score >= 2
Q&A about the site for Drupal developers and administrators
DECLARE @tag VARCHAR(30) = ##tag:string## SELECT TOP 1000 Id AS [Post Link], Score, ViewCount as Views, AnswerCount as Answers, Body, CreationDate FROM Posts WHERE AcceptedAnswerId IS NULL AND PostTypeId = 1 AND CreationDate < GETDATE() - 60 AND ClosedDate IS NULL AND Tags LIKE '%<' + LOWER(@tag) + '>%' AND NOT EXISTS ( SELECT * FROM Posts p WHERE p.ParentId = Posts.Id AND p.Score >= 2 AND p.PostTypeId = 2 )