Q&A for people looking to bypass life's everyday problems with simple tricks
DECLARE @StartDate DATE = '2021-10-01'; DECLARE @EndDate DATE = '2021-12-31'; SELECT id FROM posts WHERE PostTypeId = 1 AND score > 0 AND AnswerCount > 0 AND ( ( CreationDate BETWEEN @StartDate AND @EndDate AND viewcount > 5000 AND LastActivityDate BETWEEN DATEADD(MONTH, -6, GETDATE()) AND GETDATE() ) OR ( CreationDate BETWEEN @StartDate AND @EndDate AND viewcount > 10000 AND LastActivityDate BETWEEN DATEADD(MONTH, -12, GETDATE()) AND DATEADD(MONTH, -6, GETDATE()) ) OR ( CreationDate BETWEEN @StartDate AND @EndDate AND viewcount >= 25000 AND viewcount <= 50000 AND LastActivityDate < DATEADD(MONTH, -12, GETDATE()) ) OR ( CreationDate BETWEEN @StartDate AND @EndDate AND viewcount > 50000 ) )