Lower scoring accepted answer posted after highest scoring answer

0

Please login or register to vote for this query.

(click on this box to dismiss)

Science Fiction and Fantasy Meta

Q&A about the site for science fiction and fantasy enthusiasts

select 
q.Id as [Post Link], 
max(aa.score) as 'aa score',
max(hs.score) as 'later answer hs',
max(hs.score) - max(aa.score) as aa_hs_diff
from 
Posts as q 
left join Posts as aa on q.Id = aa.ParentId --- aa: accepted answer
left join Posts as hs on q.Id = hs.ParentId --- hs: highest scoring answer
where 
q.PostTypeId = 1 and
q.AcceptedAnswerId is not null and
q.AnswerCount > 1 and
aa.Score < hs.Score and --- aa has lower score, ordering will change
aa.Id = q.AcceptedAnswerId and
aa.CreationDate > hs.CreationDate and
hs.Score = (Select max(score) from Posts csq where csq.ParentId = q.id) 
---and not q.tags like '%single-word-requests%' ---- remove first 3 dashes to exclude SWR
group by q.Id
order by aa_hs_diff DESC;

Enter Parameters

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