SELECT p1.Id, p1.Title, acc.Score as AcceptedScore, MAX(a...

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 p1.Id, p1.Title, acc.Score as AcceptedScore, MAX(ans.Score) as HighestScore FROM POSTS p1  
  INNER JOIN POSTS acc on acc.Id = p1.AcceptedAnswerId
  INNER JOIN POSTS ans on ans.ParentId = p1.Id and ans.PostTypeId = 2 and ans.Id != acc.Id
WHERE p1.PostTypeId = 1
GROUP BY p1.Id, p1.Title, acc.Score
HAVING acc.Score  > MAX(ans.Score);

Enter Parameters

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