Accept rate by user

1

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

DECLARE @UserId int = ##UserId##
SELECT @UserId as [User Link],
  COUNT(1) AS answers_count,
  SUM(case when q.id is null then 0 else 1 end) as accepted_count,
  SUM(case when q.id is null then 0 else 1 end)*1.0/COUNT(1) as accept_rate
FROM posts a
left join posts q on a.parentid = q.id and q.posttypeid = 1
   and a.id = q.acceptedanswerid 
where a.posttypeid = 2
and a.owneruserid = @UserId
order by SUM(case when q.id is null then 0 else 1 end)*1.0/COUNT(1) desc

Enter Parameters

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