Recent Activity

0

Please login or register to vote for this query.

(click on this box to dismiss)

Display number of answers, unique answerers, and active users in the past ##days## days.

Stack Overflow

Q&A for professional and enthusiast programmers

WITH RecentAnswers AS (
  SELECT 
    COUNT(*) AS Answers,
    COUNT(DISTINCT OwnerUserId) AS Answerers
  FROM 
    Posts
  WHERE 
    PostTypeId = 2 AND DATEDIFF(DAY, CreationDate, GETDATE()) <= ##days##
),

RecentQuestions AS (
  SELECT 
    COUNT(*) AS Questions,
    COUNT(DISTINCT OwnerUserId) AS Askers
  FROM 
    Posts
  WHERE 
    PostTypeId = 1 AND DATEDIFF(DAY, CreationDate, GETDATE()) <= ##days##
),

ActiveUsers AS (
  SELECT 
    COUNT(*) AS Users
  FROM
    Users
  WHERE
    DATEDIFF(DAY, LastAccessDate, GETDATE()) <= ##days##
)

SELECT
  *
FROM
  ActiveUsers, RecentQuestions, RecentAnswers

Enter Parameters

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