Percentage of Answers edited by Owner, by Year

1

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
  year(creationdate) as [Year],
  
  count(id) [NumAnswers],
  
  sum(case when LastEditorUserId is not null
   then 1 else 0 end ) as [Edited],
   
  sum(case when LastEditorUserId = owneruserid
   then 1 else 0 end ) as [Edit by Owner],
   
  format(sum(case when LastEditorUserId = owneruserid
   then 1.0 else 0.0 end ) / sum(case when LastEditorUserId is not null
   then 1.0 else 0.0 end ),'0.0%') as [% Owner Edit]
  
from 
  posts

where 
  posttypeid = 2
 
group by 
  year(creationdate)

Enter Parameters

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