Answers with best score, but question has no accepted answer

1

Please login or register to vote for this query.

(click on this box to dismiss)

Find all your unappreciated answers.

Stack Overflow

Q&A for programmers

-- Answers with best score, but question has no accepted answer
-- Find all your unappreciated answers.

SELECT a1.id as [Post Link],  
        a1.CreationDate, a1.Score, Scores.maxScore as [Next Best], a1.lastActivityDate, a1.CommentCount
FROM Posts a1
INNER JOIN Posts q 
     ON q.ID = a1.ParentID
INNER JOIN (SELECT MAX(p.Score) as maxScore,p.ParentID as ID FROM Posts p WHERE p.OwnerUserId<>##UserId## GROUP BY p.ParentId) Scores
     ON a1.ParentID = Scores.ID
WHERE 
    a1.OwnerUserID= ##UserId## 
    AND q.AcceptedAnswerID IS NULL
AND Scores.maxScore < a1.Score
ORDER BY a1.lastActivityDate DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached