Top users without new posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Shows the top 500 users whose last post was before the specified date.

Stack Overflow

Q&A for programmers

-- Top users without new posts
-- Shows the top 500 users whose last post was before the specified date.

DECLARE @EndDate datetime
SET @EndDate = '##EndDate##';

WITH TopUsers AS
(
  SELECT TOP ##UserCount## Id, DisplayName, Reputation
  FROM Users
  ORDER BY Reputation DESC
),
LastPostDates AS
(
  SELECT OwnerUserId, MAX(CreationDate) AS LastPostDate
  FROM Posts
  GROUP BY OwnerUserId
)
SELECT u.Id, u.DisplayName, u.Reputation, p.LastPostDate
FROM TopUsers u
INNER JOIN LastPostDates p
  ON p.OwnerUserId = u.Id
WHERE p.LastPostDate < @EndDate
ORDER BY u.Reputation DESC

Enter Parameters

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