Self-answered questions

2

Please login or register to vote for this query.

(click on this box to dismiss)

How many of their own questions has a user answered?

Webmasters

Q&A for pro webmasters

-- Self-answered questions
-- How many of their own questions has a user answered?

select
    Q.OwnerUserId as [User Link],
    Q.OwnerUserId [User ID],
    Count(distinct A.ParentID) [Self-Answered],
    count(*) [Questions],
    convert(decimal(10,2),100) * Count(distinct A.ParentID) / count(*) [Percentage],
    rank() over (order by convert(decimal(10,2),100) * Count(distinct A.ParentID) / count(*) desc) [Rank]
from Posts Q 
left join Posts A on Q.Id = A.ParentId and Q.OwnerUserId = A.OwnerUserId
where Q.OwnerUserId is not null and Q.PostTypeId = 1
group by Q.OwnerUserId
having count(*) > 100
order by case when Q.OwnerUserID != ##UserId## then 1 end, Percentage desc

Enter Parameters

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