late answers that have higher score than new answer

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT q.Id AS [Post Link]
FROM Posts AS q
INNER JOIN Posts AS a
ON a.ParentId = q.Id
INNER JOIN Posts AS aa
ON aa.ParentId = q.Id
WHERE
    q.PostTypeId = 1
and a.PostTypeId = 2
and aa.PostTypeId = 2
and q.AcceptedAnswerId = aa.Id
and q.AnswerCount >= 2
and DATEDIFF(DAY, q.CreationDate, a.CreationDate) <= 7
and DATEDIFF(DAY, q.CreationDate, aa.CreationDate) >= 30
and a.Score < aa.Score
GROUP BY q.Id

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results