% of SO questions with voted answers through a given date

0

Please login or register to vote for this query.

(click on this box to dismiss)

Displays the percentage of questions which had at least one answer with a non-zero score through a given date

Stack Overflow

Q&A for programmers

-- SO Answers with Non-zero score % through a given date
-- Displays the percentage of questions which had 
-- at least one answer with a non-zero score through a given date
DECLARE @day DATE = ##Date:string##

DECLARE @answered int = (select count(*) from posts as q
WHERE
PostTypeId=1
AND CreationDate < @day
AND (ClosedDate is null or ClosedDate >= @day)
AND EXISTS (
  select id from posts
  where posttypeid=2
  and parentid=q.id
  and creationdate < @day
  AND Score != 0
)
)

DECLARE @total int = (
  select count(*) from posts
  where PostTypeId=1 and CreationDate < @day
  AND (ClosedDate is null or ClosedDate >= @day)
)

select @answered*100/@total

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached