Accepted answers to questions old more than a period

0

Please login or register to vote for this query.

(click on this box to dismiss)

Moderators

Q&A for community managers, administrators, and moderators

-- Shows accepted answers to questions old more than a period
-- ResultCount: Number of results to display
-- AnsweringThreshold: The question should have been created [x] months ago

SELECT TOP ##ResultCount:int##
       q.Id as [Post Link],
       q.Score as [Question scored],
       u.Id as [User Link],
       q.CreationDate as [Asked on],
       a.Score as [Answer scored],
       a.CreationDate as [Answered on],
       au.Id as [User Link]
       FROM Posts q
       JOIN Posts a ON q.AcceptedAnswerId = a.Id
       JOIN Users u ON q.OwnerUserId = u.Id
       JOIN Users au ON a.OwnerUserId = au.Id
       WHERE q.PostTypeId = 1
             AND DATEDIFF(month, q.CreationDate, a.CreationDate) >= ##AnsweringThreshold:int##
             AND q.AcceptedAnswerId IS NOT NULL
             ORDER BY q.Id DESC

Enter Parameters

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