Closed Questions by Week

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

WITH cte 
     AS (SELECT Dateadd(week, Datepart(week, creationdate), '1/1/' + 
                   CAST(YEAR(creationdate) AS 
                                CHAR(4))) 
                    cdate, 
                CASE 
                  WHEN closeddate IS NOT NULL THEN 1 
                  ELSE 0 
                END closed, 
                id 
         FROM   posts 
         WHERE  posttypeid = 1) 
SELECT cdate, 
       ( CAST(SUM(closed) AS DECIMAL (15, 4)) / 
         CAST(COUNT(id)AS DECIMAL (15, 4)) )  closeRate
FROM   cte 
GROUP  BY cdate 
ORDER  BY cdate

Enter Parameters

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