select a as "Months Active Since Question", b as "Unresol...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Writers

Q&A for the craft of professional writing, including fiction, non-fiction, technical, scholarly, and commercial writing

select
  a as "Months Active Since Question",
  b as "Unresolved Questions",
  c as "Answered Questions",
  100.0 * b / c as "Percent Unresolved"
from (

  select n,

  (select count(*)from Posts P
    left join Users U on P.OwnerUserId = U.Id  
    where P.AnswerCount > 0
    and datediff(month, P.CreationDate, U.LastAccessDate) >= n
    and P.AcceptedAnswerId is null
  ),

  (select count(*) from Posts P
    left join Users U on P.OwnerUserId = U.Id 
    where P.AnswerCount > 0
    and datediff(month, P.CreationDate, U.LastAccessDate) >= n
  )

  from (values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12)) m(n)

) t(a,b,c)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results