Answers to old unanswered questions

1

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

DECLARE @AskTime DATETIME = convert(DATETIME, '##AskTime?2020/01/01 00:00:00##')
DECLARE @StartTime DATETIME = convert(DATETIME, '##StartTime?2020/04/01 00:00:00##')
DECLARE @EndTime DATETIME = convert(DATETIME, '##EndTime?2020/05/01 00:00:00##')

SELECT A.Id AS [Post Link], A.Score, 
  (CASE WHEN Q.AcceptedAnswerId = A.Id THEN 1 ELSE 0 END) AS Accepted, 
  A.OwnerUserId AS [User Link]
FROM
  Posts A INNER JOIN Posts Q ON A.ParentId = Q.Id
WHERE
  A.CreationDate BETWEEN @StartTime AND @EndTime AND
  Q.PostTypeId = 1 AND
  Q.ClosedDate IS NULL AND
  Q.CreationDate < @AskTime AND
  NOT EXISTS (SELECT * FROM Posts B WHERE
    B.ParentId = Q.Id AND B.CreationDate < @StartTime)
ORDER BY A.Score DESC, Accepted DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results