highest voted answer is the accepted answer, and at least 2 answers exist


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

q.Id as [Post Link], 
max(aa.score) as 'aa score'
Posts as q 
left join Posts as aa on q.Id = aa.ParentId --- aa: accepted answer
q.PostTypeId = 1 and
q.AcceptedAnswerId is not null and
q.AnswerCount > 1 and
aa.Id = q.AcceptedAnswerId and
aa.Score = (Select max(score) from Posts csq where csq.ParentId = q.id)
group by q.id
order by max(aa.score) DESC;

Enter Parameters

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