Number of questions by week, and Score Quality

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sustainable Living

Q&A for folks dedicated to a lifestyle that can be maintained indefinitely without depleting available resources

SELECT ((DATEDIFF(DAY,##StartDate:string##,P.CreationDate))) AS Day,
       CONVERT(date,DATEADD(DAY,((DATEDIFF(DAY,##StartDate:string##,P.CreationDate))),##StartDate:string##)) AS WeekStarting,
       CONVERT(date,MAX(P.CreationDate)) AS WeekEnding,
       COUNT(P.Id) AS QuestionsAsked,
       COUNT(CASE WHEN P.Score > 0 THEN 1 END) AS PositiveScore,
       COUNT(CASE WHEN P.Score = 0 THEN 1 END) AS NeutralScore,
       COUNT(CASE WHEN P.Score < 0 THEN 1 END) AS NegativeScore,
       COUNT(P.DeletionDate) AS DeletedQuestions,
       COUNT(P.ClosedDate) AS Closed
FROM dbo.PostsWithDeleted P
     JOIN dbo.PostTypes PT ON P.PostTypeId = PT.Id
WHERE P.CreationDate >= ##StartDate:string##
  AND P.CreationDate < ##EndDate:string##
  AND PT.[Name] = 'Question'
GROUP BY ((DATEDIFF(DAY,##StartDate:string##,P.CreationDate)))
ORDER BY ((DATEDIFF(DAY,##StartDate:string##,P.CreationDate)));

Enter Parameters

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