25

I've gotten a few Necromancer badges for answering questions that were months or even a couple of years old. In some cases, the OP came back around to grant my answer as the accepted solution.

It got me wondering this:

What's the longest length in time from when an OP posted a question to when the first accepted answer was entered?

Don't count the time for when the OP came back to accept. Don't count answers to questions that already had an accepted answer.

5
  • 8
    This seems like a candidate for SEDE?
    – Daedalus
    Commented Feb 20, 2022 at 6:33
  • 9
    42. Commented Feb 20, 2022 at 9:21
  • 25
    We don't know yet, that answer hasn't been posted yet.
    – Dharman Mod
    Commented Feb 20, 2022 at 10:44
  • 1
    @EatenbyaGrue How do you write such short comments? I promise to be responsible :-). Commented Feb 20, 2022 at 17:34
  • 11
    @SylvesterKruin the period is a link to this question
    – Julia
    Commented Feb 20, 2022 at 17:53

1 Answer 1

35

Here is the query

select top 10 
       datediff(d, q.creationdate, a.creationdate) [days]
     , q.id [Post Link]
     , q.creationdate
     , q.score [q score]
     , a.creationdate [ Accepted Answer Created] 
     , a.score [a score]
     , v.creationdate [Accepted by OP on]
from posts q
inner join posts a on a.id = q.acceptedanswerid
inner join votes v on v.postid = a.id and votetypeid = 1
where q.posttypeid = 1 -- Question
order by datediff(d, q.creationdate, a.creationdate) desc

The answer is: 4685 days for this question How to convert a week (200851) into a date (2008-12-27)?

Note that we don't have public info which answers have been accepted and unaccepted during the life-time of a Q/A. We only know the current state.

Keep in mind SEDE is updated once a week on Sunday.
Use the fine SEDE Tutorial written by the admirable Monica Cellio.
Say "Hi" in SEDE chat.

9
  • 2
    Wow, I was under the impression that the votes table included that info. TIL.
    – Braiam
    Commented Feb 20, 2022 at 13:19
  • 6
    @Braiam yeah, it is something you would expect but the logic for accept votes is that the previous vote is "undone", as if it never happened. Similar to unupvote and undownvote, those aren't found in the votes table either. It is a pitty.
    – rene
    Commented Feb 20, 2022 at 13:32
  • 14
    4685 days is ~12.83561644 years, in case anyone's wondering. Commented Feb 20, 2022 at 18:45
  • 3
    Up next: write a bot that automatically updates this answer every month or so, or every time the stats would change :-). Commented Feb 22, 2022 at 21:20
  • 11
    @SylvesterKruin up next: a bot that finds an unanswered question that has been unanswered slightly longer than the answer to this question, and answers it.
    – abligh
    Commented Feb 22, 2022 at 21:49
  • 1
    Now to figure out the query to find the oldest unanswered questions by users that have logged on within the last year
    – M. Justin
    Commented Feb 22, 2022 at 22:19
  • 1
    @abligh do know we have a fine site (which I might or might not be affiliated with) where you find info on how to create such a bot by leveraging the Stack API: stackapps.com
    – rene
    Commented Feb 22, 2022 at 23:13
  • "Note that we don't have public info which answers have been accepted and unaccepted during the life-time of a Q/A. " Then isn't your query showing the largest gap between asking date and the accepted answer date? That's much different than what was asked . Maybe there is then no solid answer possible due to lack of data.. Commented Feb 23, 2022 at 1:16
  • Be right back, about to close a question about December 2008 as no longer applicable. Commented Feb 23, 2022 at 5:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .