average number of accepted answers / number of answers where there is more than one answer

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

if (select count(*) as total
from posts q 
inner join posts a on a.parentid = q.id
where q.posttypeid = 1 
and a.posttypeid = 2
and q.acceptedanswerid is not null
and q.answercount > 1
and a.owneruserid = ##UserId##) > 0
select cast(cast(mine as float) / total  * 100 as varchar) + '%' from 
(select count(*) as mine
from posts q 
inner join posts a on a.parentid = q.id
where q.posttypeid = 1 
and a.posttypeid = 2
and q.acceptedanswerid is not null
and q.answercount > 1
and a.owneruserid = ##UserId##
and q.acceptedanswerid = a.id) mine,
(select count(*) as total
from posts q 
inner join posts a on a.parentid = q.id
where q.posttypeid = 1 
and a.posttypeid = 2
and q.acceptedanswerid is not null
and q.answercount > 1
and a.owneruserid = ##UserId##) total
else select 'User has not answered any questions where there are multiple answers, one of which is accepted'

Enter Parameters

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